mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-04 11:15:12 +00:00
* Converted the option declarations in options.nix to nested attribute
sets that match the hierarchical structure of the options. So instead of { name = ["time" "timeZone"]; default = "CET"; example = "America/New_York"; description = "The time zone used when displaying times and dates."; } we have time = { timeZone = { default = "CET"; example = "America/New_York"; description = "The time zone used when displaying times and dates."; }; }; And instead of `config.get ["time" "timeZone"]' you can now just say `config.time.timeZone'. Furthermore, this option representation will allow option structures with repetition (such as in networking.interfaces or services.httpd.subservices) to be defined. svn path=/nixos/trunk/; revision=9618
This commit is contained in:
parent
c4ad7b56d1
commit
62c1f0ddcc
@ -5,17 +5,20 @@
|
||||
|
||||
pkgs: config:
|
||||
|
||||
let lib = pkgs.library; in
|
||||
let
|
||||
|
||||
rec {
|
||||
lib = pkgs.library;
|
||||
|
||||
# The option declarations, i.e., option names with defaults and
|
||||
# documentation.
|
||||
declarations = import ./options.nix {inherit pkgs;};
|
||||
declarations = import ./options.nix {inherit pkgs; inherit (lib) mkOption;};
|
||||
|
||||
configFilled = lib.addDefaultOptionValues declarations config;
|
||||
|
||||
# Get the option named `name' from the user configuration, using
|
||||
# its default value if it's not defined.
|
||||
get = name:
|
||||
/*
|
||||
let
|
||||
decl =
|
||||
lib.findSingle (decl: lib.eqLists decl.name name)
|
||||
@ -27,7 +30,11 @@ rec {
|
||||
then abort ("Option `" + printName name + "' has no default.")
|
||||
else decl.default;
|
||||
in lib.getAttr name default config;
|
||||
*/
|
||||
let
|
||||
default = abort ("Undeclared option `" + printName name + "'.");
|
||||
in lib.getAttr name default configFilled;
|
||||
|
||||
printName = name: lib.concatStrings (lib.intersperse "." name);
|
||||
|
||||
}
|
||||
in configFilled // {inherit get;}
|
||||
|
2687
system/options.nix
2687
system/options.nix
File diff suppressed because it is too large
Load Diff
@ -31,11 +31,11 @@ rec {
|
||||
|
||||
nix = pkgs.nixUnstable; # we need the exportReferencesGraph feature
|
||||
|
||||
kernel = (config.get ["boot" "kernel"]) pkgs;
|
||||
kernel = config.boot.kernel pkgs;
|
||||
|
||||
rootModules =
|
||||
(config.get ["boot" "initrd" "extraKernelModules"]) ++
|
||||
(config.get ["boot" "initrd" "kernelModules"]);
|
||||
config.boot.initrd.extraKernelModules ++
|
||||
config.boot.initrd.kernelModules;
|
||||
|
||||
|
||||
# Determine the set of modules that we need to mount the root FS.
|
||||
|
Loading…
Reference in New Issue
Block a user