Merge pull request #60349 from matthewbauer/fix-60345
check-meta: use system tuple in platforms
This commit is contained in:
commit
760c9995b0
@ -50,7 +50,7 @@ let
|
|||||||
filesystem = callLibs ./filesystem.nix;
|
filesystem = callLibs ./filesystem.nix;
|
||||||
|
|
||||||
# back-compat aliases
|
# back-compat aliases
|
||||||
platforms = systems.forMeta;
|
platforms = systems.doubles;
|
||||||
|
|
||||||
inherit (builtins) add addErrorContext attrNames concatLists
|
inherit (builtins) add addErrorContext attrNames concatLists
|
||||||
deepSeq elem elemAt filter genericClosure genList getAttr
|
deepSeq elem elemAt filter genericClosure genList getAttr
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
rec {
|
rec {
|
||||||
doubles = import ./doubles.nix { inherit lib; };
|
doubles = import ./doubles.nix { inherit lib; };
|
||||||
forMeta = import ./for-meta.nix { inherit lib; };
|
|
||||||
parse = import ./parse.nix { inherit lib; };
|
parse = import ./parse.nix { inherit lib; };
|
||||||
inspect = import ./inspect.nix { inherit lib; };
|
inspect = import ./inspect.nix { inherit lib; };
|
||||||
platforms = import ./platforms.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
|
# `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
|
# clearly prefered, and to prevent cycles. A simpler fixed point where the RHS
|
||||||
# always just used `final.*` would fail on both counts.
|
# 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 = {
|
final = {
|
||||||
# Prefer to parse `config` as it is strictly more informative.
|
# Prefer to parse `config` as it is strictly more informative.
|
||||||
parsed = parse.mkSystemFromString (if args ? config then args.config else args.system);
|
parsed = parse.mkSystemFromString (if args ? config then args.config else args.system);
|
||||||
|
@ -19,6 +19,8 @@ let
|
|||||||
"x86_64-windows" "i686-windows"
|
"x86_64-windows" "i686-windows"
|
||||||
|
|
||||||
"wasm64-wasi" "wasm32-wasi"
|
"wasm64-wasi" "wasm32-wasi"
|
||||||
|
|
||||||
|
"riscv32-linux" "riscv64-linux"
|
||||||
];
|
];
|
||||||
|
|
||||||
allParsed = map parse.mkSystemFromString all;
|
allParsed = map parse.mkSystemFromString all;
|
||||||
@ -36,6 +38,7 @@ in rec {
|
|||||||
i686 = filterDoubles predicates.isi686;
|
i686 = filterDoubles predicates.isi686;
|
||||||
x86_64 = filterDoubles predicates.isx86_64;
|
x86_64 = filterDoubles predicates.isx86_64;
|
||||||
mips = filterDoubles predicates.isMips;
|
mips = filterDoubles predicates.isMips;
|
||||||
|
riscv = filterDoubles predicates.isRiscV;
|
||||||
|
|
||||||
cygwin = filterDoubles predicates.isCygwin;
|
cygwin = filterDoubles predicates.isCygwin;
|
||||||
darwin = filterDoubles predicates.isDarwin;
|
darwin = filterDoubles predicates.isDarwin;
|
||||||
|
@ -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;
|
|
||||||
}
|
|
@ -169,7 +169,7 @@ let
|
|||||||
license = either (listOf lib.types.attrs) (either lib.types.attrs str);
|
license = either (listOf lib.types.attrs) (either lib.types.attrs str);
|
||||||
maintainers = listOf (attrsOf str);
|
maintainers = listOf (attrsOf str);
|
||||||
priority = int;
|
priority = int;
|
||||||
platforms = listOf (either str lib.systems.parsedPlatform.types.system);
|
platforms = listOf str;
|
||||||
hydraPlatforms = listOf str;
|
hydraPlatforms = listOf str;
|
||||||
broken = bool;
|
broken = bool;
|
||||||
# TODO: refactor once something like Profpatsch's types-simple will land
|
# 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)}]";
|
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 [];
|
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
|
checkOutputsToInstall = attrs: let
|
||||||
expectedOutputs = attrs.meta.outputsToInstall or [];
|
expectedOutputs = attrs.meta.outputsToInstall or [];
|
||||||
actualOutputs = attrs.outputs or [ "out" ];
|
actualOutputs = attrs.outputs or [ "out" ];
|
||||||
@ -236,8 +231,10 @@ let
|
|||||||
{ valid = false; reason = "blacklisted"; errormsg = "has a blacklisted license (‘${showLicense attrs.meta.license}’)"; }
|
{ valid = false; reason = "blacklisted"; errormsg = "has a blacklisted license (‘${showLicense attrs.meta.license}’)"; }
|
||||||
else if !allowBroken && attrs.meta.broken or false then
|
else if !allowBroken && attrs.meta.broken or false then
|
||||||
{ valid = false; reason = "broken"; errormsg = "is marked as broken"; }
|
{ valid = false; reason = "broken"; errormsg = "is marked as broken"; }
|
||||||
else if !allowUnsupportedSystem && !(checkPlatform attrs) then
|
else if !allowUnsupportedSystem &&
|
||||||
{ valid = false; reason = "unsupported"; errormsg = "is not supported on ‘${hostPlatform.config}’"; }
|
(!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
|
else if !(hasAllowedInsecure attrs) then
|
||||||
{ valid = false; reason = "insecure"; errormsg = "is marked as insecure"; }
|
{ valid = false; reason = "insecure"; errormsg = "is marked as insecure"; }
|
||||||
else if checkOutputsToInstall attrs then
|
else if checkOutputsToInstall attrs then
|
||||||
|
@ -57,11 +57,11 @@ in let
|
|||||||
|
|
||||||
# From a minimum of `system` or `config` (actually a target triple, *not*
|
# From a minimum of `system` or `config` (actually a target triple, *not*
|
||||||
# nixpkgs configuration), infer the other one and platform as needed.
|
# 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
|
# Allow setting the platform in the config file. This take precedence over
|
||||||
# the inferred platform, but not over an explicitly passed-in one.
|
# the inferred platform, but not over an explicitly passed-in one.
|
||||||
builtins.intersectAttrs { platform = null; } config1
|
builtins.intersectAttrs { platform = null; } config1
|
||||||
// args.localSystem);
|
// args.localSystem) else args.localSystem);
|
||||||
|
|
||||||
crossSystem = if crossSystem0 == null then localSystem
|
crossSystem = if crossSystem0 == null then localSystem
|
||||||
else lib.systems.elaborate crossSystem0;
|
else lib.systems.elaborate crossSystem0;
|
||||||
|
@ -85,6 +85,7 @@ import ./. (builtins.removeAttrs args [ "system" "platform" ] // {
|
|||||||
inherit config overlays crossSystem crossOverlays;
|
inherit config overlays crossSystem crossOverlays;
|
||||||
# Fallback: Assume we are building packages on the current (build, in GNU
|
# Fallback: Assume we are building packages on the current (build, in GNU
|
||||||
# Autotools parlance) system.
|
# Autotools parlance) system.
|
||||||
localSystem = (if args ? localSystem then {}
|
localSystem = if builtins.isString localSystem then localSystem
|
||||||
|
else (if args ? localSystem then {}
|
||||||
else { system = builtins.currentSystem; }) // localSystem;
|
else { system = builtins.currentSystem; }) // localSystem;
|
||||||
})
|
})
|
||||||
|
@ -22,7 +22,7 @@ let
|
|||||||
in runCommand "${cmd}-${version}" {
|
in runCommand "${cmd}-${version}" {
|
||||||
meta = {
|
meta = {
|
||||||
priority = 10;
|
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; };
|
passthru = { inherit provider; };
|
||||||
preferLocalBuild = true;
|
preferLocalBuild = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user