mkOverride
lib.mkOverride
Docs pulled from | This Revision | 14 minutes ago
Nixpkgs manual
Labels a definition with a priority.
See the documentation of filterOverrides for the interpretation of the priority value.
Nesting this function usually leads to an invalid definition.
mkDefault, mkOptionDefault, and mkForce partially apply mkOverride with common priorities used in the NixOS module system.
Inputs
priority-
A numeric value representing the precedence. See the documentation of
filterOverridesfor the interpretation of this value. content-
The definition to be labeled with a given priority.
Examples
lib.modules.mkOverride usage example
mkOverride 1000 "hello, world!"
=> { _type = "override"; content = "hello, world!"; priority = 1000; }
(lib.evalModules {
modules = [
{ options.foo = lib.mkOption { }; }
{ config.foo = lib.mkOverride 20 1; }
{ config.foo = lib.mkOverride 10 2; }
];
}).config
=> { foo = 2; }
Noogle detected
Implementation
The following is the current implementation of this function.
mkOverride = priority: content: {
_type = "override";
inherit priority content;
};