2009-05-27 11:16:56 +02:00
|
|
|
# From an end-user configuration file (`configuration'), build a NixOS
|
|
|
|
# configuration object (`config') from which we can retrieve option
|
|
|
|
# values.
|
|
|
|
|
2009-06-05 15:19:39 +02:00
|
|
|
{ configuration
|
|
|
|
, system ? builtins.currentSystem
|
|
|
|
, nixpkgs ? import ./from-env.nix "NIXPKGS" /etc/nixos/nixpkgs
|
|
|
|
, pkgs ? import nixpkgs {inherit system;}
|
|
|
|
}:
|
2009-05-27 11:16:56 +02:00
|
|
|
|
|
|
|
rec {
|
2009-06-05 15:19:39 +02:00
|
|
|
inherit nixpkgs pkgs;
|
|
|
|
|
2009-05-27 11:16:56 +02:00
|
|
|
configComponents = [
|
|
|
|
configuration
|
2009-05-28 18:20:08 +02:00
|
|
|
{
|
|
|
|
require = import ../modules/module-list.nix;
|
|
|
|
environment.checkConfigurationOptions = pkgs.lib.mkOption {
|
|
|
|
default = true;
|
|
|
|
example = false;
|
|
|
|
description = ''
|
|
|
|
Whether to check the validity of the entire configuration.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|
2009-05-27 11:16:56 +02:00
|
|
|
];
|
|
|
|
|
2009-06-05 15:19:39 +02:00
|
|
|
config_ =
|
2009-05-27 11:16:56 +02:00
|
|
|
pkgs.lib.fixOptionSets
|
|
|
|
pkgs.lib.mergeOptionSets
|
2009-07-06 18:20:58 +02:00
|
|
|
{ inherit pkgs; } configComponents;
|
2009-05-27 11:16:56 +02:00
|
|
|
|
|
|
|
optionDeclarations =
|
|
|
|
pkgs.lib.fixOptionSetsFun
|
|
|
|
pkgs.lib.filterOptionSets
|
2009-07-06 18:20:58 +02:00
|
|
|
{ inherit pkgs; } configComponents
|
2009-06-05 15:19:39 +02:00
|
|
|
config_;
|
|
|
|
|
|
|
|
# Optionally check wether all config values have corresponding
|
|
|
|
# option declarations.
|
|
|
|
config = pkgs.checker config_
|
|
|
|
config_.environment.checkConfigurationOptions
|
|
|
|
optionDeclarations config_;
|
2009-05-27 11:16:56 +02:00
|
|
|
}
|