···11# This file defines the structure of the `config` nixpkgs option.
2233-{ lib, ... }:
33+{ config, lib, ... }:
4455with lib;
66···3232 };
33333434 /* Config options */
3535+3636+ warnUndeclaredOptions = mkOption {
3737+ description = "Whether to warn when <literal>config</literal> contains an unrecognized attribute.";
3838+ default = false;
3939+ };
35403641 doCheckByDefault = mkMassRebuild {
3742 feature = "run <literal>checkPhase</literal> by default";
···122127123128in {
124129130130+ freeformType =
131131+ let t = lib.types.attrsOf lib.types.raw;
132132+ in t // {
133133+ merge = loc: defs:
134134+ let r = t.merge loc defs;
135135+ in r // { _undeclared = r; };
136136+ };
137137+125138 inherit options;
139139+140140+ config = {
141141+ warnings = lib.optionals config.warnUndeclaredOptions (
142142+ lib.mapAttrsToList (k: v: "undeclared Nixpkgs option set: config.${k}") config._undeclared
143143+ );
144144+ };
126145127146}
+2-4
pkgs/top-level/default.nix
···7979 ./config.nix
8080 ({ options, ... }: {
8181 _file = "nixpkgs.config";
8282- # filter-out known options, FIXME: remove this eventually
8383- config = builtins.intersectAttrs options config1;
8282+ config = config1;
8483 })
8584 ];
8685 };
87868887 # take all the rest as-is
8989- config = lib.showWarnings configEval.config.warnings
9090- (config1 // builtins.removeAttrs configEval.config [ "_module" ]);
8888+ config = lib.showWarnings configEval.config.warnings configEval.config;
91899290 # A few packages make a new package set to draw their dependencies from.
9391 # (Currently to get a cross tool chain, or forced-i686 package.) Rather than