summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/default.nix2
-rw-r--r--lib/systems/default.nix5
-rw-r--r--lib/systems/doubles.nix3
-rw-r--r--lib/systems/for-meta.nix38
-rw-r--r--pkgs/stdenv/generic/check-meta.nix13
-rw-r--r--pkgs/top-level/default.nix4
-rw-r--r--pkgs/top-level/impure.nix5
-rw-r--r--pkgs/top-level/unix-tools.nix2
8 files changed, 18 insertions, 54 deletions
diff --git a/lib/default.nix b/lib/default.nix
index 8735b6476795..3efaaf0f8f9e 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -50,7 +50,7 @@ let
filesystem = callLibs ./filesystem.nix;
# back-compat aliases
- platforms = systems.forMeta;
+ platforms = systems.doubles;
inherit (builtins) add addErrorContext attrNames concatLists
deepSeq elem elemAt filter genericClosure genList getAttr
diff --git a/lib/systems/default.nix b/lib/systems/default.nix
index 5e6d277be7d5..8aa413f53817 100644
--- a/lib/systems/default.nix
+++ b/lib/systems/default.nix
@@ -3,7 +3,6 @@
rec {
doubles = import ./doubles.nix { inherit lib; };
- forMeta = import ./for-meta.nix { inherit lib; };
parse = import ./parse.nix { inherit lib; };
inspect = import ./inspect.nix { inherit lib; };
platforms = import ./platforms.nix { inherit lib; };
@@ -15,7 +14,9 @@ rec {
# `parsed` is inferred from args, both because there are two options with one
# clearly prefered, and to prevent cycles. A simpler fixed point where the RHS
# always just used `final.*` would fail on both counts.
- elaborate = args: let
+ elaborate = args': let
+ args = if lib.isString args' then { system = args'; }
+ else args';
final = {
# Prefer to parse `config` as it is strictly more informative.
parsed = parse.mkSystemFromString (if args ? config then args.config else args.system);
diff --git a/lib/systems/doubles.nix b/lib/systems/doubles.nix
index c6877ebef0bc..ff071c182d4f 100644
--- a/lib/systems/doubles.nix
+++ b/lib/systems/doubles.nix
@@ -19,6 +19,8 @@ let
"x86_64-windows" "i686-windows"
"wasm64-wasi" "wasm32-wasi"
+
+ "riscv32-linux" "riscv64-linux"
];
allParsed = map parse.mkSystemFromString all;
@@ -36,6 +38,7 @@ in rec {
i686 = filterDoubles predicates.isi686;
x86_64 = filterDoubles predicates.isx86_64;
mips = filterDoubles predicates.isMips;
+ riscv = filterDoubles predicates.isRiscV;
cygwin = filterDoubles predicates.isCygwin;
darwin = filterDoubles predicates.isDarwin;
diff --git a/lib/systems/for-meta.nix b/lib/systems/for-meta.nix
deleted file mode 100644
index 17ae94deb7d1..000000000000
--- a/lib/systems/for-meta.nix
+++ /dev/null
@@ -1,38 +0,0 @@
-{ lib }:
-let
- inherit (lib.systems) parse;
- inherit (lib.systems.inspect) patterns;
-
- abis = lib.mapAttrs (_: abi: builtins.removeAttrs abi [ "assertions" ]) parse.abis;
-
-in rec {
- all = [ {} ]; # `{}` matches anything
- none = [];
-
- arm = [ patterns.isAarch32 ];
- aarch64 = [ patterns.isAarch64 ];
- x86 = [ patterns.isx86 ];
- i686 = [ patterns.isi686 ];
- x86_64 = [ patterns.isx86_64 ];
- mips = [ patterns.isMips ];
- riscv = [ patterns.isRiscV ];
-
- cygwin = [ patterns.isCygwin ];
- darwin = [ patterns.isDarwin ];
- freebsd = [ patterns.isFreeBSD ];
- # Should be better, but MinGW is unclear.
- gnu = [
- { kernel = parse.kernels.linux; abi = abis.gnu; }
- { kernel = parse.kernels.linux; abi = abis.gnueabi; }
- { kernel = parse.kernels.linux; abi = abis.gnueabihf; }
- ];
- illumos = [ patterns.isSunOS ];
- linux = [ patterns.isLinux ];
- netbsd = [ patterns.isNetBSD ];
- openbsd = [ patterns.isOpenBSD ];
- unix = patterns.isUnix; # Actually a list
- windows = [ patterns.isWindows ];
- wasi = [ patterns.isWasi ];
-
- inherit (lib.systems.doubles) mesaPlatforms;
-}
diff --git a/pkgs/stdenv/generic/check-meta.nix b/pkgs/stdenv/generic/check-meta.nix
index 8cb0ad79587e..89e2a7a8031c 100644
--- a/pkgs/stdenv/generic/check-meta.nix
+++ b/pkgs/stdenv/generic/check-meta.nix
@@ -169,7 +169,7 @@ let
license = either (listOf lib.types.attrs) (either lib.types.attrs str);
maintainers = listOf (attrsOf str);
priority = int;
- platforms = listOf (either str lib.systems.parsedPlatform.types.system);
+ platforms = listOf str;
hydraPlatforms = listOf str;
broken = bool;
# TODO: refactor once something like Profpatsch's types-simple will land
@@ -210,11 +210,6 @@ let
else "key '${k}' is unrecognized; expected one of: \n\t [${lib.concatMapStringsSep ", " (x: "'${x}'") (lib.attrNames metaTypes)}]";
checkMeta = meta: if shouldCheckMeta then lib.remove null (lib.mapAttrsToList checkMetaAttr meta) else [];
- checkPlatform = attrs: let
- anyMatch = lib.any (lib.meta.platformMatch hostPlatform);
- in anyMatch (attrs.meta.platforms or lib.platforms.all) &&
- ! anyMatch (attrs.meta.badPlatforms or []);
-
checkOutputsToInstall = attrs: let
expectedOutputs = attrs.meta.outputsToInstall or [];
actualOutputs = attrs.outputs or [ "out" ];
@@ -236,8 +231,10 @@ let
{ valid = false; reason = "blacklisted"; errormsg = "has a blacklisted license (‘${showLicense attrs.meta.license}’)"; }
else if !allowBroken && attrs.meta.broken or false then
{ valid = false; reason = "broken"; errormsg = "is marked as broken"; }
- else if !allowUnsupportedSystem && !(checkPlatform attrs) then
- { valid = false; reason = "unsupported"; errormsg = "is not supported on ‘${hostPlatform.config}’"; }
+ else if !allowUnsupportedSystem &&
+ (!lib.lists.elem hostPlatform.system (attrs.meta.platforms or lib.platforms.all) ||
+ lib.lists.elem hostPlatform.system (attrs.meta.badPlatforms or [])) then
+ { valid = false; reason = "unsupported"; errormsg = "is not supported on ‘${hostPlatform.system}’"; }
else if !(hasAllowedInsecure attrs) then
{ valid = false; reason = "insecure"; errormsg = "is marked as insecure"; }
else if checkOutputsToInstall attrs then
diff --git a/pkgs/top-level/default.nix b/pkgs/top-level/default.nix
index b6de076a570c..904ef8d39796 100644
--- a/pkgs/top-level/default.nix
+++ b/pkgs/top-level/default.nix
@@ -57,11 +57,11 @@ in let
# From a minimum of `system` or `config` (actually a target triple, *not*
# nixpkgs configuration), infer the other one and platform as needed.
- localSystem = lib.systems.elaborate (
+ localSystem = lib.systems.elaborate (if builtins.isAttrs args.localSystem then (
# Allow setting the platform in the config file. This take precedence over
# the inferred platform, but not over an explicitly passed-in one.
builtins.intersectAttrs { platform = null; } config1
- // args.localSystem);
+ // args.localSystem) else args.localSystem);
crossSystem = if crossSystem0 == null then localSystem
else lib.systems.elaborate crossSystem0;
diff --git a/pkgs/top-level/impure.nix b/pkgs/top-level/impure.nix
index da288f15d2e2..3ba6c08a140b 100644
--- a/pkgs/top-level/impure.nix
+++ b/pkgs/top-level/impure.nix
@@ -85,6 +85,7 @@ import ./. (builtins.removeAttrs args [ "system" "platform" ] // {
inherit config overlays crossSystem crossOverlays;
# Fallback: Assume we are building packages on the current (build, in GNU
# Autotools parlance) system.
- localSystem = (if args ? localSystem then {}
- else { system = builtins.currentSystem; }) // localSystem;
+ localSystem = if builtins.isString localSystem then localSystem
+ else (if args ? localSystem then {}
+ else { system = builtins.currentSystem; }) // localSystem;
})
diff --git a/pkgs/top-level/unix-tools.nix b/pkgs/top-level/unix-tools.nix
index 00edb7c09072..beb2a996a5ef 100644
--- a/pkgs/top-level/unix-tools.nix
+++ b/pkgs/top-level/unix-tools.nix
@@ -22,7 +22,7 @@ let
in runCommand "${cmd}-${version}" {
meta = {
priority = 10;
- platforms = map (n: { kernel.name = n; }) (attrNames providers);
+ platforms = lib.platforms.${stdenv.hostPlatform.parsed.kernel.name} or lib.platforms.all;
};
passthru = { inherit provider; };
preferLocalBuild = true;