diff options
author | pennae <82953136+pennae@users.noreply.github.com> | 2022-09-01 16:10:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-01 16:10:09 +0200 |
commit | 3bddcf5f9002814a8bec50025418faa3fd3f6138 (patch) | |
tree | 5ae3ebf10acce3ad00d4a2468f8e64c41a2c749b /lib | |
parent | 1d41cff3dc4c8f37bb5841f51fcbff705e169178 (diff) | |
parent | e7312d54f184e5c3e0f1ef29028f6dae8fa34a97 (diff) |
Merge branch 'master' into option-docs-md
Diffstat (limited to 'lib')
-rw-r--r-- | lib/modules.nix | 4 | ||||
-rw-r--r-- | lib/systems/doubles.nix | 4 | ||||
-rw-r--r-- | lib/systems/examples.nix | 5 | ||||
-rw-r--r-- | lib/systems/inspect.nix | 9 | ||||
-rw-r--r-- | lib/systems/parse.nix | 10 | ||||
-rwxr-xr-x | lib/tests/modules.sh | 1 | ||||
-rw-r--r-- | lib/tests/modules/disable-define-enable-string-path.nix | 5 |
7 files changed, 32 insertions, 6 deletions
diff --git a/lib/modules.nix b/lib/modules.nix index 659f1dd75dd1a..d3a7fac82c4ab 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -399,7 +399,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 { diff --git a/lib/systems/doubles.nix b/lib/systems/doubles.nix index 6b2ea63624af3..709b67607f7b4 100644 --- a/lib/systems/doubles.nix +++ b/lib/systems/doubles.nix @@ -96,7 +96,9 @@ in { ++ filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnueabi; }) ++ filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnueabihf; }) ++ filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnuabin32; }) - ++ filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnuabi64; }); + ++ filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnuabi64; }) + ++ filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnuabielfv1; }) + ++ filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnuabielfv2; }); illumos = filterDoubles predicates.isSunOS; linux = filterDoubles predicates.isLinux; netbsd = filterDoubles predicates.isNetBSD; diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index 65dc9c07e3465..0d9f67037764f 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -22,12 +22,11 @@ rec { }; ppc64 = { - config = "powerpc64-unknown-linux-gnu"; - gcc = { abi = "elfv2"; }; # for gcc configuration + config = "powerpc64-unknown-linux-gnuabielfv2"; }; ppc64-musl = { config = "powerpc64-unknown-linux-musl"; - gcc = { abi = "elfv2"; }; # for gcc configuration + gcc = { abi = "elfv2"; }; }; sheevaplug = { diff --git a/lib/systems/inspect.nix b/lib/systems/inspect.nix index 54d398018e0b1..ee213438e0485 100644 --- a/lib/systems/inspect.nix +++ b/lib/systems/inspect.nix @@ -13,6 +13,13 @@ rec { isx86_64 = { cpu = { family = "x86"; bits = 64; }; }; isPower = { cpu = { family = "power"; }; }; isPower64 = { cpu = { family = "power"; bits = 64; }; }; + # This ABI is the default in NixOS PowerPC64 BE, but not on mainline GCC, + # so it sometimes causes issues in certain packages that makes the wrong + # assumption on the used ABI. + isAbiElfv2 = [ + { abi = { abi = "elfv2"; }; } + { abi = { name = "musl"; }; cpu = { family = "power"; bits = 64; }; } + ]; isx86 = { cpu = { family = "x86"; }; }; isAarch32 = { cpu = { family = "arm"; bits = 32; }; }; isAarch64 = { cpu = { family = "arm"; bits = 64; }; }; @@ -65,7 +72,7 @@ rec { isNone = { kernel = kernels.none; }; isAndroid = [ { abi = abis.android; } { abi = abis.androideabi; } ]; - isGnu = with abis; map (a: { abi = a; }) [ gnuabi64 gnu gnueabi gnueabihf ]; + isGnu = with abis; map (a: { abi = a; }) [ gnuabi64 gnu gnueabi gnueabihf gnuabielfv1 gnuabielfv2 ]; isMusl = with abis; map (a: { abi = a; }) [ musl musleabi musleabihf muslabin32 muslabi64 ]; isUClibc = with abis; map (a: { abi = a; }) [ uclibc uclibceabi uclibceabihf ]; diff --git a/lib/systems/parse.nix b/lib/systems/parse.nix index be5b1a0892bba..ac450534fe1e8 100644 --- a/lib/systems/parse.nix +++ b/lib/systems/parse.nix @@ -353,6 +353,11 @@ rec { The "gnu" ABI is ambiguous on 32-bit ARM. Use "gnueabi" or "gnueabihf" instead. ''; } + { assertion = platform: with platform; !(isPower64 && isBigEndian); + message = '' + The "gnu" ABI is ambiguous on big-endian 64-bit PowerPC. Use "gnuabielfv2" or "gnuabielfv1" instead. + ''; + } ]; }; gnuabi64 = { abi = "64"; }; @@ -364,6 +369,9 @@ rec { gnuabin32 = { abi = "n32"; }; muslabin32 = { abi = "n32"; }; + gnuabielfv2 = { abi = "elfv2"; }; + gnuabielfv1 = { abi = "elfv1"; }; + musleabi = { float = "soft"; }; musleabihf = { float = "hard"; }; musl = {}; @@ -467,6 +475,8 @@ rec { if lib.versionAtLeast (parsed.cpu.version or "0") "6" then abis.gnueabihf else abis.gnueabi + # Default ppc64 BE to ELFv2 + else if isPower64 parsed && isBigEndian parsed then abis.gnuabielfv2 else abis.gnu else abis.unknown; }; diff --git a/lib/tests/modules.sh b/lib/tests/modules.sh index c92cc62023b56..2ef7c48065952 100755 --- a/lib/tests/modules.sh +++ b/lib/tests/modules.sh @@ -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 diff --git a/lib/tests/modules/disable-define-enable-string-path.nix b/lib/tests/modules/disable-define-enable-string-path.nix new file mode 100644 index 0000000000000..6429a6d6354ae --- /dev/null +++ b/lib/tests/modules/disable-define-enable-string-path.nix @@ -0,0 +1,5 @@ +{ lib, ... }: + +{ + disabledModules = [ (toString ./define-enable.nix) ]; +} |