mirror of
https://github.com/CHN-beta/nixpkgs.git
synced 2026-01-12 02:40:31 +08:00
Revert "lib/modules: disallow setting config, options in specialArgs of evalModules"
This commit is contained in:
committed by
GitHub
parent
c5e2528c7c
commit
a8d0d315de
@@ -5,7 +5,6 @@ let
|
||||
addErrorContext
|
||||
all
|
||||
any
|
||||
assertMsg
|
||||
attrByPath
|
||||
attrNames
|
||||
catAttrs
|
||||
@@ -102,8 +101,6 @@ let
|
||||
, # This would be remove in the future, Prefer _module.check option instead.
|
||||
check ? true
|
||||
}:
|
||||
assert assertMsg (!specialArgs?config) "Do not set config in the specialArgs argument to evalModules.";
|
||||
assert assertMsg (!specialArgs?options) "Do not set options in the specialArgs argument to evalModules.";
|
||||
let
|
||||
withWarnings = x:
|
||||
warnIf (evalModulesArgs?args) "The args argument to evalModules is deprecated. Please set config._module.args instead."
|
||||
|
||||
@@ -137,9 +137,6 @@ checkConfigOutput '^true$' config.result ./module-argument-default.nix
|
||||
# gvariant
|
||||
checkConfigOutput '^true$' config.assertion ./gvariant.nix
|
||||
|
||||
# specialArgs checks for evalModules
|
||||
checkConfigError 'Do not set config in the specialArgs argument to evalModules\.' config.fail.config ./specialArgs-config.nix
|
||||
checkConfigError 'Do not set options in the specialArgs argument to evalModules\.' config.fail.config ./specialArgs-options.nix
|
||||
checkConfigOutput '"ok"' config.result ./specialArgs-lib.nix
|
||||
|
||||
# https://github.com/NixOS/nixpkgs/pull/131205
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
{ lib, ... }:
|
||||
{
|
||||
config = {
|
||||
_module.freeformType = lib.types.anything;
|
||||
|
||||
fail = lib.evalModules {
|
||||
specialArgs = {
|
||||
config = { };
|
||||
};
|
||||
modules = [
|
||||
{
|
||||
options.a = lib.mkEnableOption "a";
|
||||
config.a = true;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
{ lib, ... }:
|
||||
{
|
||||
config = {
|
||||
_module.freeformType = lib.types.anything;
|
||||
|
||||
fail = lib.evalModules {
|
||||
specialArgs = {
|
||||
options = { };
|
||||
};
|
||||
modules = [
|
||||
{
|
||||
options.a = lib.mkEnableOption "a";
|
||||
config.a = true;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user