@@ -41,7 +41,7 @@
4141} @ args:
4242
4343let # Rename the function arguments
44− configExpr = config;
44+ config0 = config;
4545 crossSystem0 = crossSystem;
4646
4747in let
@@ -50,22 +50,37 @@ in let
5050 # Allow both:
5151 # { /* the config */ } and
5252 # { pkgs, ... } : { /* the config */ }
53− config =
54− if lib.isFunction configExpr
55− then configExpr { inherit pkgs; }
56− else configExpr;
53+ config1 =
54+ if lib.isFunction config0
55+ then config0 { inherit pkgs; }
56+ else config0;
5757
5858 # From a minimum of `system` or `config` (actually a target triple, *not*
5959 # nixpkgs configuration), infer the other one and platform as needed.
6060 localSystem = lib.systems.elaborate (
6161 # Allow setting the platform in the config file. This take precedence over
6262 # the inferred platform, but not over an explicitly passed-in one.
63− builtins.intersectAttrs { platform = null; } config
63+ builtins.intersectAttrs { platform = null; } config1
6464 // args.localSystem);
6565
6666 crossSystem = if crossSystem0 == null then localSystem
6767 else lib.systems.elaborate crossSystem0;
6868
69+ configEval = lib.evalModules {
70+ modules = [
71+ ./config.nix
72+ ({ options, ... }: {
73+ _file = "nixpkgs.config";
74+ # filter-out known options, FIXME: remove this eventually
75+ config = builtins.intersectAttrs options config1;
76+ })
77+ ];
78+ };
79+
80+ # take all the rest as-is
81+ config = lib.showWarnings configEval.config.warnings
82+ (config1 // builtins.removeAttrs configEval.config [ "_module" ]);
83+
6984 # A few packages make a new package set to draw their dependencies from.
7085 # (Currently to get a cross tool chain, or forced-i686 package.) Rather than
7186 # give `all-packages.nix` all the arguments to this function, even ones that