1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-24 06:31:02 +00:00
nixpkgs/lib/eval-config.nix
Eelco Dolstra f1035de47c * For the generation of manual / manpages, don't evaluate the option
declarations again (because we already have them).  This cuts
  evaluation time from 7.2s to 4.9s.

svn path=/nixos/trunk/; revision=16798
2009-08-21 09:08:55 +00:00

44 lines
1.1 KiB
Nix

# From an end-user configuration file (`configuration'), build a NixOS
# configuration object (`config') from which we can retrieve option
# values.
{ configuration
, system ? builtins.currentSystem
, nixpkgs ? import ./from-env.nix "NIXPKGS" /etc/nixos/nixpkgs
, pkgs ? import nixpkgs {inherit system;}
, extraArgs ? {}
, extraModules ? []
}:
let extraArgs_ = extraArgs; in
rec {
inherit nixpkgs pkgs;
configComponents =
[ configuration
./check-config.nix
]
++ extraModules
++ (import ../modules/module-list.nix);
extraArgs = extraArgs_ // {
inherit pkgs optionDeclarations;
modulesPath = ../modules;
};
config_ =
pkgs.lib.definitionsOf configComponents extraArgs;
# "fixableDeclarationsOf" is used instead of "declarationsOf" because some
# option default values may depends on the definition of other options.
optionDeclarations =
pkgs.lib.fixableDeclarationsOf configComponents extraArgs config_;
# Optionally check wether all config values have corresponding
# option declarations.
config = pkgs.checker config_
config_.environment.checkConfigurationOptions
optionDeclarations config_;
}