pkgs/top-level/config.nix: Add warnUndeclaredOptions
This commit is contained in:
parent
4d2237c841
commit
596b3663a5
|
@ -1,6 +1,6 @@
|
|||
# This file defines the structure of the `config` nixpkgs option.
|
||||
|
||||
{ lib, ... }:
|
||||
{ config, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
|
@ -28,6 +28,11 @@ let
|
|||
|
||||
/* Config options */
|
||||
|
||||
warnUndeclaredOptions = mkOption {
|
||||
description = "Whether to warn when <literal>config</literal> contains an unrecognized attribute.";
|
||||
default = false;
|
||||
};
|
||||
|
||||
doCheckByDefault = mkMassRebuild {
|
||||
feature = "run <literal>checkPhase</literal> by default";
|
||||
};
|
||||
|
@ -113,6 +118,15 @@ let
|
|||
|
||||
in {
|
||||
|
||||
freeformType =
|
||||
let t = lib.types.attrsOf lib.types.raw;
|
||||
in t // {
|
||||
merge = loc: defs:
|
||||
lib.mapAttrs
|
||||
(k: v: lib.warnIf config.warnUndeclaredOptions "undeclared Nixpkgs option set: config.${k}" v)
|
||||
(t.merge loc defs);
|
||||
};
|
||||
|
||||
inherit options;
|
||||
|
||||
}
|
||||
|
|
|
@ -79,15 +79,13 @@ in let
|
|||
./config.nix
|
||||
({ options, ... }: {
|
||||
_file = "nixpkgs.config";
|
||||
# filter-out known options, FIXME: remove this eventually
|
||||
config = builtins.intersectAttrs options config1;
|
||||
config = config1;
|
||||
})
|
||||
];
|
||||
};
|
||||
|
||||
# take all the rest as-is
|
||||
config = lib.showWarnings configEval.config.warnings
|
||||
(config1 // builtins.removeAttrs configEval.config [ "_module" ]);
|
||||
config = lib.showWarnings configEval.config.warnings configEval.config;
|
||||
|
||||
# A few packages make a new package set to draw their dependencies from.
|
||||
# (Currently to get a cross tool chain, or forced-i686 package.) Rather than
|
||||
|
|
Loading…
Reference in New Issue
Block a user