mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 23:13:19 +00:00
Merge pull request #188289 from erikarvstedt/fix-disabled-modules-abs-paths
lib.modules: support strings with absolute paths in `disabledModules`
This commit is contained in:
commit
3ebb588ab3
@ -433,7 +433,9 @@ rec {
|
||||
# modules recursively. It returns the final list of unique-by-key modules
|
||||
filterModules = modulesPath: { disabled, modules }:
|
||||
let
|
||||
moduleKey = m: if isString m then toString modulesPath + "/" + m else toString m;
|
||||
moduleKey = m: if isString m && (builtins.substring 0 1 m != "/")
|
||||
then toString modulesPath + "/" + m
|
||||
else toString m;
|
||||
disabledKeys = map moduleKey disabled;
|
||||
keyFilter = filter (attrs: ! elem attrs.key disabledKeys);
|
||||
in map (attrs: attrs.module) (builtins.genericClosure {
|
||||
|
@ -130,6 +130,7 @@ checkConfigOutput '^true$' "$@" ./define-enable.nix ./define-attrsOfSub-foo-enab
|
||||
set -- config.enable ./define-enable.nix ./declare-enable.nix
|
||||
checkConfigOutput '^true$' "$@"
|
||||
checkConfigOutput '^false$' "$@" ./disable-define-enable.nix
|
||||
checkConfigOutput '^false$' "$@" ./disable-define-enable-string-path.nix
|
||||
checkConfigError "The option .*enable.* does not exist. Definition values:\n\s*- In .*: true" "$@" ./disable-declare-enable.nix
|
||||
checkConfigError "attribute .*enable.* in selection path .*config.enable.* not found" "$@" ./disable-define-enable.nix ./disable-declare-enable.nix
|
||||
checkConfigError "attribute .*enable.* in selection path .*config.enable.* not found" "$@" ./disable-enable-modules.nix
|
||||
|
5
lib/tests/modules/disable-define-enable-string-path.nix
Normal file
5
lib/tests/modules/disable-define-enable-string-path.nix
Normal file
@ -0,0 +1,5 @@
|
||||
{ lib, ... }:
|
||||
|
||||
{
|
||||
disabledModules = [ (toString ./define-enable.nix) ];
|
||||
}
|
Loading…
Reference in New Issue
Block a user