From 5b7f7d2de1d2bc81d65b209a3d759d601528606d Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 27 May 2009 09:16:56 +0000 Subject: [PATCH] * Move the config evaluation into a separate expression so that it can be reused, e.g. for building the CD/DVD. svn path=/nixos/branches/modular-nixos/; revision=15744 --- default.nix | 21 +++------------------ lib/eval-config.nix | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+), 18 deletions(-) create mode 100644 lib/eval-config.nix diff --git a/default.nix b/default.nix index 45e43c18e6d1..df69ee4c3e2e 100644 --- a/default.nix +++ b/default.nix @@ -9,29 +9,14 @@ let nixpkgs = fromEnv "NIXPKGS" /etc/nixos/nixpkgs; pkgs = import nixpkgs {system = builtins.currentSystem;}; - - configComponents = [ - configuration - (import ./system/options.nix) - ]; - # Make a configuration object from which we can retrieve option - # values. - config = - pkgs.lib.fixOptionSets - pkgs.lib.mergeOptionSets - pkgs configComponents; + inherit + (import ./lib/eval-config.nix {inherit configuration pkgs;}) + config optionDeclarations; - optionDeclarations = - pkgs.lib.fixOptionSetsFun - pkgs.lib.filterOptionSets - pkgs configComponents - config; - in { - # Optionally check wether all config values have corresponding # option declarations. system = pkgs.checker config.system.build.system diff --git a/lib/eval-config.nix b/lib/eval-config.nix new file mode 100644 index 000000000000..e1cf7ac3cf6f --- /dev/null +++ b/lib/eval-config.nix @@ -0,0 +1,23 @@ +# From an end-user configuration file (`configuration'), build a NixOS +# configuration object (`config') from which we can retrieve option +# values. + +{configuration, pkgs}: + +rec { + configComponents = [ + configuration + (import ../system/options.nix) + ]; + + config = + pkgs.lib.fixOptionSets + pkgs.lib.mergeOptionSets + pkgs configComponents; + + optionDeclarations = + pkgs.lib.fixOptionSetsFun + pkgs.lib.filterOptionSets + pkgs configComponents + config; +}