diff --git a/lib/default.nix b/lib/default.nix index 7bd02106f7b6b..cbe0a0ba21b59 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -47,7 +47,7 @@ let filesystem = callLibs ./filesystem.nix; # back-compat aliases - platforms = systems.doubles; + platforms = systems.forMeta; inherit (builtins) add addErrorContext attrNames concatLists deepSeq elem elemAt filter genericClosure genList diff --git a/lib/meta.nix b/lib/meta.nix index 07b1710fff70a..199030c103af5 100644 --- a/lib/meta.nix +++ b/lib/meta.nix @@ -67,4 +67,23 @@ rec { */ hiPrioSet = set: mapDerivationAttrset hiPrio set; + + /* Check to see if a platform is matched by the given `meta.platforms` + element. + + A `meta.platform` pattern is either + + 1. (legacy) a system string. + + 2. (modern) a pattern for the platform `parsed` field. + + We can inject these into a patten for the whole of a structured platform, + and then match that. + */ + platformMatch = platform: elem: let + pattern = + if builtins.isString elem + then { system = elem; } + else { parsed = elem; }; + in lib.matchAttrs pattern platform; } diff --git a/lib/systems/default.nix b/lib/systems/default.nix index d5a206e620c82..bd408e00bb142 100644 --- a/lib/systems/default.nix +++ b/lib/systems/default.nix @@ -3,6 +3,7 @@ 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; }; diff --git a/lib/systems/doubles.nix b/lib/systems/doubles.nix index 20294a28a1107..012a1786a3ccb 100644 --- a/lib/systems/doubles.nix +++ b/lib/systems/doubles.nix @@ -24,19 +24,20 @@ let in rec { inherit all; - allBut = platforms: lists.filter (x: !(builtins.elem x platforms)) all; none = []; arm = filterDoubles predicates.isArm; + aarch64 = filterDoubles predicates.isAarch64; + x86 = filterDoubles predicates.isx86; i686 = filterDoubles predicates.isi686; - mips = filterDoubles predicates.isMips; x86_64 = filterDoubles predicates.isx86_64; + mips = filterDoubles predicates.isMips; cygwin = filterDoubles predicates.isCygwin; darwin = filterDoubles predicates.isDarwin; freebsd = filterDoubles predicates.isFreeBSD; # Should be better, but MinGW is unclear, and HURD is bit-rotted. - gnu = filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnu; }); + gnu = filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnu; }); illumos = filterDoubles predicates.isSunOS; linux = filterDoubles predicates.isLinux; netbsd = filterDoubles predicates.isNetBSD; diff --git a/lib/systems/for-meta.nix b/lib/systems/for-meta.nix new file mode 100644 index 0000000000000..63f24b4653553 --- /dev/null +++ b/lib/systems/for-meta.nix @@ -0,0 +1,30 @@ +{ lib }: +let + inherit (lib.systems) parse; + inherit (lib.systems.inspect) patterns; + +in rec { + all = [ {} ]; # `{}` matches anything + none = []; + + arm = [ patterns.isArm ]; + aarch64 = [ patterns.isAarch64 ]; + x86 = [ patterns.isx86 ]; + i686 = [ patterns.isi686 ]; + x86_64 = [ patterns.isx86_64 ]; + mips = [ patterns.isMips ]; + + cygwin = [ patterns.isCygwin ]; + darwin = [ patterns.isDarwin ]; + freebsd = [ patterns.isFreeBSD ]; + # Should be better, but MinGW is unclear, and HURD is bit-rotted. + gnu = [ { kernel = parse.kernels.linux; abi = parse.abis.gnu; } ]; + illumos = [ patterns.isSunOS ]; + linux = [ patterns.isLinux ]; + netbsd = [ patterns.isNetBSD ]; + openbsd = [ patterns.isOpenBSD ]; + unix = patterns.isUnix; # Actually a list + windows = [ patterns.isWindows ]; + + inherit (lib.systems.doubles) mesaPlatforms; +} diff --git a/lib/systems/inspect.nix b/lib/systems/inspect.nix index ab220af46e303..a7bd17f68a459 100644 --- a/lib/systems/inspect.nix +++ b/lib/systems/inspect.nix @@ -5,51 +5,49 @@ with lib.lists; rec { patterns = rec { - i686 = { cpu = cpuTypes.i686; }; - x86_64 = { cpu = cpuTypes.x86_64; }; - PowerPC = { cpu = cpuTypes.powerpc; }; - x86 = { cpu = { family = "x86"; }; }; - Arm = { cpu = { family = "arm"; }; }; - Aarch64 = { cpu = { family = "aarch64"; }; }; - Mips = { cpu = { family = "mips"; }; }; - RiscV = { cpu = { family = "riscv"; }; }; - Wasm = { cpu = { family = "wasm"; }; }; - - "32bit" = { cpu = { bits = 32; }; }; - "64bit" = { cpu = { bits = 64; }; }; - BigEndian = { cpu = { significantByte = significantBytes.bigEndian; }; }; - LittleEndian = { cpu = { significantByte = significantBytes.littleEndian; }; }; - - BSD = { kernel = { families = { inherit (kernelFamilies) bsd; }; }; }; - Unix = [ BSD Darwin Linux SunOS Hurd Cygwin ]; - - Darwin = { kernel = kernels.darwin; }; - Linux = { kernel = kernels.linux; }; - SunOS = { kernel = kernels.solaris; }; - FreeBSD = { kernel = kernels.freebsd; }; - Hurd = { kernel = kernels.hurd; }; - NetBSD = { kernel = kernels.netbsd; }; - OpenBSD = { kernel = kernels.openbsd; }; - Windows = { kernel = kernels.windows; }; - Cygwin = { kernel = kernels.windows; abi = abis.cygnus; }; - MinGW = { kernel = kernels.windows; abi = abis.gnu; }; - - Android = [ { abi = abis.android; } { abi = abis.androideabi; } ]; - Musl = with abis; map (a: { abi = a; }) [ musl musleabi musleabihf ]; - - Kexecable = map (family: { kernel = kernels.linux; cpu.family = family; }) - [ "x86" "arm" "aarch64" "mips" ]; - Efi = map (family: { cpu.family = family; }) - [ "x86" "arm" "aarch64" ]; - Seccomputable = map (family: { kernel = kernels.linux; cpu.family = family; }) - [ "x86" "arm" "aarch64" "mips" ]; + isi686 = { cpu = cpuTypes.i686; }; + isx86_64 = { cpu = cpuTypes.x86_64; }; + isPowerPC = { cpu = cpuTypes.powerpc; }; + isx86 = { cpu = { family = "x86"; }; }; + isArm = { cpu = { family = "arm"; }; }; + isAarch64 = { cpu = { family = "aarch64"; }; }; + isMips = { cpu = { family = "mips"; }; }; + isRiscV = { cpu = { family = "riscv"; }; }; + isWasm = { cpu = { family = "wasm"; }; }; + + is32bit = { cpu = { bits = 32; }; }; + is64bit = { cpu = { bits = 64; }; }; + isBigEndian = { cpu = { significantByte = significantBytes.bigEndian; }; }; + isLittleEndian = { cpu = { significantByte = significantBytes.littleEndian; }; }; + + isBSD = { kernel = { families = { inherit (kernelFamilies) bsd; }; }; }; + isUnix = [ isBSD isDarwin isLinux isSunOS isHurd isCygwin ]; + + isDarwin = { kernel = kernels.darwin; }; + isLinux = { kernel = kernels.linux; }; + isSunOS = { kernel = kernels.solaris; }; + isFreeBSD = { kernel = kernels.freebsd; }; + isHurd = { kernel = kernels.hurd; }; + isNetBSD = { kernel = kernels.netbsd; }; + isOpenBSD = { kernel = kernels.openbsd; }; + isWindows = { kernel = kernels.windows; }; + isCygwin = { kernel = kernels.windows; abi = abis.cygnus; }; + isMinGW = { kernel = kernels.windows; abi = abis.gnu; }; + + isAndroid = [ { abi = abis.android; } { abi = abis.androideabi; } ]; + isMusl = with abis; map (a: { abi = a; }) [ musl musleabi musleabihf ]; + + isKexecable = map (family: { kernel = kernels.linux; cpu.family = family; }) + [ "x86" "arm" "aarch64" "mips" ]; + isEfi = map (family: { cpu.family = family; }) + [ "x86" "arm" "aarch64" ]; + isSeccomputable = map (family: { kernel = kernels.linux; cpu.family = family; }) + [ "x86" "arm" "aarch64" "mips" ]; }; matchAnyAttrs = patterns: if builtins.isList patterns then attrs: any (pattern: matchAttrs pattern attrs) patterns else matchAttrs patterns; - predicates = mapAttrs' - (name: value: nameValuePair ("is" + name) (matchAnyAttrs value)) - patterns; + predicates = mapAttrs (_: matchAnyAttrs) patterns; } diff --git a/nixos/release.nix b/nixos/release.nix index 9d41d954a01b9..cd0ce6dc7b185 100644 --- a/nixos/release.nix +++ b/nixos/release.nix @@ -16,15 +16,14 @@ let inherit system; } // args); - # Note: only supportedSystems are considered. - callTestOnTheseSystems = systems: fn: args: - forTheseSystems - (intersectLists supportedSystems systems) + callTestOnMatchingSystems = systems: fn: args: + forMatchingSystems + systems (system: hydraJob (importTest fn args system)); - callTest = callTestOnTheseSystems supportedSystems; + callTest = callTestOnMatchingSystems supportedSystems; - callSubTests = callSubTestsOnTheseSystems supportedSystems; - callSubTestsOnTheseSystems = systems: fn: args: let + callSubTests = callSubTestsOnMatchingSystems supportedSystems; + callSubTestsOnMatchingSystems = systems: fn: args: let discover = attrs: let subTests = filterAttrs (const (hasAttr "test")) attrs; in mapAttrs (const (t: hydraJob t.test)) subTests; @@ -138,7 +137,7 @@ in rec { # Build the initial ramdisk so Hydra can keep track of its size over time. initialRamdisk = buildFromConfig ({ pkgs, ... }: { }) (config: config.system.build.initialRamdisk); - netboot = forTheseSystems [ "x86_64-linux" "aarch64-linux" ] (system: makeNetboot { + netboot = forMatchingSystems [ "x86_64-linux" "aarch64-linux" ] (system: makeNetboot { inherit system; modules = [ ./modules/installer/netboot/netboot-minimal.nix @@ -152,7 +151,7 @@ in rec { inherit system; }); - iso_graphical = forTheseSystems [ "x86_64-linux" ] (system: makeIso { + iso_graphical = forMatchingSystems [ "x86_64-linux" ] (system: makeIso { module = ./modules/installer/cd-dvd/installation-cd-graphical-kde.nix; type = "graphical"; inherit system; @@ -160,7 +159,7 @@ in rec { # A variant with a more recent (but possibly less stable) kernel # that might support more hardware. - iso_minimal_new_kernel = forTheseSystems [ "x86_64-linux" ] (system: makeIso { + iso_minimal_new_kernel = forMatchingSystems [ "x86_64-linux" ] (system: makeIso { module = ./modules/installer/cd-dvd/installation-cd-minimal-new-kernel.nix; type = "minimal-new-kernel"; inherit system; @@ -172,7 +171,7 @@ in rec { }); # A bootable VirtualBox virtual appliance as an OVA file (i.e. packaged OVF). - ova = forTheseSystems [ "x86_64-linux" ] (system: + ova = forMatchingSystems [ "x86_64-linux" ] (system: with import nixpkgs { inherit system; }; @@ -248,9 +247,9 @@ in rec { tests.boot-stage1 = callTest tests/boot-stage1.nix {}; tests.borgbackup = callTest tests/borgbackup.nix {}; tests.buildbot = callTest tests/buildbot.nix {}; - tests.cadvisor = callTestOnTheseSystems ["x86_64-linux"] tests/cadvisor.nix {}; - tests.ceph = callTestOnTheseSystems ["x86_64-linux"] tests/ceph.nix {}; - tests.chromium = (callSubTestsOnTheseSystems ["x86_64-linux"] tests/chromium.nix {}).stable or {}; + tests.cadvisor = callTestOnMatchingSystems ["x86_64-linux"] tests/cadvisor.nix {}; + tests.ceph = callTestOnMatchingSystems ["x86_64-linux"] tests/ceph.nix {}; + tests.chromium = (callSubTestsOnMatchingSystems ["x86_64-linux"] tests/chromium.nix {}).stable or {}; tests.cjdns = callTest tests/cjdns.nix {}; tests.cloud-init = callTest tests/cloud-init.nix {}; tests.containers-ipv4 = callTest tests/containers-ipv4.nix {}; @@ -264,21 +263,21 @@ in rec { tests.containers-hosts = callTest tests/containers-hosts.nix {}; tests.containers-macvlans = callTest tests/containers-macvlans.nix {}; tests.couchdb = callTest tests/couchdb.nix {}; - tests.docker = callTestOnTheseSystems ["x86_64-linux"] tests/docker.nix {}; - tests.docker-tools = callTestOnTheseSystems ["x86_64-linux"] tests/docker-tools.nix {}; - tests.docker-edge = callTestOnTheseSystems ["x86_64-linux"] tests/docker-edge.nix {}; + tests.docker = callTestOnMatchingSystems ["x86_64-linux"] tests/docker.nix {}; + tests.docker-tools = callTestOnMatchingSystems ["x86_64-linux"] tests/docker-tools.nix {}; + tests.docker-edge = callTestOnMatchingSystems ["x86_64-linux"] tests/docker-edge.nix {}; tests.dovecot = callTest tests/dovecot.nix {}; - tests.dnscrypt-proxy = callTestOnTheseSystems ["x86_64-linux"] tests/dnscrypt-proxy.nix {}; + tests.dnscrypt-proxy = callTestOnMatchingSystems ["x86_64-linux"] tests/dnscrypt-proxy.nix {}; tests.ecryptfs = callTest tests/ecryptfs.nix {}; - tests.etcd = callTestOnTheseSystems ["x86_64-linux"] tests/etcd.nix {}; - tests.ec2-nixops = (callSubTestsOnTheseSystems ["x86_64-linux"] tests/ec2.nix {}).boot-ec2-nixops or {}; - tests.ec2-config = (callSubTestsOnTheseSystems ["x86_64-linux"] tests/ec2.nix {}).boot-ec2-config or {}; - tests.elk = callSubTestsOnTheseSystems ["x86_64-linux"] tests/elk.nix {}; + tests.etcd = callTestOnMatchingSystems ["x86_64-linux"] tests/etcd.nix {}; + tests.ec2-nixops = (callSubTestsOnMatchingSystems ["x86_64-linux"] tests/ec2.nix {}).boot-ec2-nixops or {}; + tests.ec2-config = (callSubTestsOnMatchingSystems ["x86_64-linux"] tests/ec2.nix {}).boot-ec2-config or {}; + tests.elk = callSubTestsOnMatchingSystems ["x86_64-linux"] tests/elk.nix {}; tests.env = callTest tests/env.nix {}; tests.ferm = callTest tests/ferm.nix {}; tests.firefox = callTest tests/firefox.nix {}; tests.firewall = callTest tests/firewall.nix {}; - tests.fleet = callTestOnTheseSystems ["x86_64-linux"] tests/fleet.nix {}; + tests.fleet = callTestOnMatchingSystems ["x86_64-linux"] tests/fleet.nix {}; tests.fwupd = callTest tests/fwupd.nix {}; #tests.gitlab = callTest tests/gitlab.nix {}; tests.gitolite = callTest tests/gitolite.nix {}; @@ -311,7 +310,7 @@ in rec { tests.kernel-copperhead = callTest tests/kernel-copperhead.nix {}; tests.kernel-latest = callTest tests/kernel-latest.nix {}; tests.kernel-lts = callTest tests/kernel-lts.nix {}; - tests.kubernetes = callSubTestsOnTheseSystems ["x86_64-linux"] tests/kubernetes/default.nix {}; + tests.kubernetes = callSubTestsOnMatchingSystems ["x86_64-linux"] tests/kubernetes/default.nix {}; tests.latestKernel.login = callTest tests/login.nix { latestKernel = true; }; tests.ldap = callTest tests/ldap.nix {}; #tests.lightdm = callTest tests/lightdm.nix {}; @@ -341,14 +340,14 @@ in rec { tests.nginx = callTest tests/nginx.nix { }; tests.nghttpx = callTest tests/nghttpx.nix { }; tests.nix-ssh-serve = callTest tests/nix-ssh-serve.nix { }; - tests.novacomd = callTestOnTheseSystems ["x86_64-linux"] tests/novacomd.nix { }; + tests.novacomd = callTestOnMatchingSystems ["x86_64-linux"] tests/novacomd.nix { }; tests.leaps = callTest tests/leaps.nix { }; tests.nsd = callTest tests/nsd.nix {}; tests.openssh = callTest tests/openssh.nix {}; tests.openldap = callTest tests/openldap.nix {}; tests.owncloud = callTest tests/owncloud.nix {}; tests.pam-oath-login = callTest tests/pam-oath-login.nix {}; - #tests.panamax = callTestOnTheseSystems ["x86_64-linux"] tests/panamax.nix {}; + #tests.panamax = callTestOnMatchingSystems ["x86_64-linux"] tests/panamax.nix {}; tests.peerflix = callTest tests/peerflix.nix {}; tests.php-pcre = callTest tests/php-pcre.nix {}; tests.postgresql = callSubTests tests/postgresql.nix {}; @@ -382,7 +381,7 @@ in rec { tests.tomcat = callTest tests/tomcat.nix {}; tests.udisks2 = callTest tests/udisks2.nix {}; tests.vault = callTest tests/vault.nix {}; - tests.virtualbox = callSubTestsOnTheseSystems ["x86_64-linux"] tests/virtualbox.nix {}; + tests.virtualbox = callSubTestsOnMatchingSystems ["x86_64-linux"] tests/virtualbox.nix {}; tests.wordpress = callTest tests/wordpress.nix {}; tests.xfce = callTest tests/xfce.nix {}; tests.xmonad = callTest tests/xmonad.nix {}; diff --git a/pkgs/applications/graphics/ahoviewer/default.nix b/pkgs/applications/graphics/ahoviewer/default.nix index 2d42a479999ba..b7647803b3d39 100644 --- a/pkgs/applications/graphics/ahoviewer/default.nix +++ b/pkgs/applications/graphics/ahoviewer/default.nix @@ -37,7 +37,9 @@ stdenv.mkDerivation rec { description = "A GTK2 image viewer, manga reader, and booru browser"; maintainers = with maintainers; [ skrzyp xzfc ]; license = licenses.mit; - platforms = platforms.allBut [ "darwin" "cygwin" ]; + # Unintentionally not working on Darwin: + # https://github.com/ahodesuka/ahoviewer/issues/62 + platforms = platforms.linux; }; } diff --git a/pkgs/applications/misc/robo3t/default.nix b/pkgs/applications/misc/robo3t/default.nix index fc7ff48423948..8928ee18064db 100644 --- a/pkgs/applications/misc/robo3t/default.nix +++ b/pkgs/applications/misc/robo3t/default.nix @@ -58,7 +58,7 @@ stdenv.mkDerivation rec { mkdir -p $out/share/icons cp ${icon} $out/share/icons/robomongo.png - patchelf --set-interpreter ${stdenv.glibc}/lib/ld-linux-x86-64.so.2 $BASEDIR/bin/robo3t + patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux-x86-64.so.2 $BASEDIR/bin/robo3t mkdir $out/bin @@ -70,7 +70,7 @@ stdenv.mkDerivation rec { meta = { homepage = https://robomongo.org/; description = "Query GUI for mongodb"; - platforms = stdenv.lib.intersectLists stdenv.lib.platforms.linux stdenv.lib.platforms.x86_64; + platforms = [ "x86_64-linux" ]; license = stdenv.lib.licenses.gpl3; maintainers = [ stdenv.lib.maintainers.eperuffo ]; }; diff --git a/pkgs/applications/networking/instant-messengers/pond/default.nix b/pkgs/applications/networking/instant-messengers/pond/default.nix index 002d0345a0007..5d463648bd8bc 100644 --- a/pkgs/applications/networking/instant-messengers/pond/default.nix +++ b/pkgs/applications/networking/instant-messengers/pond/default.nix @@ -2,7 +2,6 @@ fetchgit, fetchhg, fetchbzr, fetchsvn }: let - isx86_64 = stdenv.lib.any (n: n == stdenv.system) stdenv.lib.platforms.x86_64; gui = true; # Might be implemented with nixpkgs config. in buildGoPackage rec { @@ -22,11 +21,11 @@ buildGoPackage rec { nativeBuildInputs = [ pkgconfig ]; buildInputs = [ trousers gtk3 gtkspell3 ] - ++ stdenv.lib.optional isx86_64 dclxvi + ++ stdenv.lib.optional stdenv.hostPlatform.isx86_64 dclxvi ++ stdenv.lib.optionals gui [ wrapGAppsHook ]; buildFlags = stdenv.lib.optionalString (!gui) "-tags nogui"; excludedPackages = "\\(appengine\\|bn256cgo\\)"; - postPatch = stdenv.lib.optionalString isx86_64 '' + postPatch = stdenv.lib.optionalString stdenv.hostPlatform.isx86_64 '' grep -r 'bn256' | awk -F: '{print $1}' | xargs sed -i \ -e "s,golang.org/x/crypto/bn256,github.com/agl/pond/bn256cgo,g" \ -e "s,bn256\.,bn256cgo.,g" diff --git a/pkgs/applications/window-managers/i3/lock-color.nix b/pkgs/applications/window-managers/i3/lock-color.nix index ec1673f5040dd..edaa88bde23d8 100644 --- a/pkgs/applications/window-managers/i3/lock-color.nix +++ b/pkgs/applications/window-managers/i3/lock-color.nix @@ -34,6 +34,6 @@ stdenv.mkDerivation rec { # Needs the SSE2 instruction set. See upstream issue # https://github.com/chrjguill/i3lock-color/issues/44 - platforms = platforms.i686 ++ platforms.x86_64; + platforms = platforms.x86; }; } diff --git a/pkgs/data/icons/numix-icon-theme-square/default.nix b/pkgs/data/icons/numix-icon-theme-square/default.nix index 198229cce3711..99871abe5d464 100644 --- a/pkgs/data/icons/numix-icon-theme-square/default.nix +++ b/pkgs/data/icons/numix-icon-theme-square/default.nix @@ -29,7 +29,7 @@ stdenv.mkDerivation rec { description = "Numix icon theme (square version)"; homepage = https://numixproject.org; license = licenses.gpl3; - platforms = with platforms; allBut darwin; + platforms = platforms.linux; # Maybe other non-darwin Unix maintainers = with maintainers; [ romildo ]; }; } diff --git a/pkgs/development/compilers/chicken/default.nix b/pkgs/development/compilers/chicken/default.nix index 4a2893c303f43..ad9e57f794f0d 100644 --- a/pkgs/development/compilers/chicken/default.nix +++ b/pkgs/development/compilers/chicken/default.nix @@ -63,7 +63,7 @@ stdenv.mkDerivation { homepage = http://www.call-cc.org/; license = stdenv.lib.licenses.bsd3; maintainers = with stdenv.lib.maintainers; [ the-kenny ]; - platforms = with stdenv.lib.platforms; allBut darwin; + platforms = stdenv.lib.platforms.linux; # Maybe other non-darwin Unix description = "A portable compiler for the Scheme programming language"; longDescription = '' CHICKEN is a compiler for the Scheme programming language. diff --git a/pkgs/development/compilers/mono/generic.nix b/pkgs/development/compilers/mono/generic.nix index a8012f6bb9e63..3b476bce0273c 100644 --- a/pkgs/development/compilers/mono/generic.nix +++ b/pkgs/development/compilers/mono/generic.nix @@ -88,7 +88,7 @@ stdenv.mkDerivation rec { meta = { homepage = http://mono-project.com/; description = "Cross platform, open source .NET development framework"; - platforms = with stdenv.lib.platforms; allBut [ "aarch64-linux" ]; + platforms = stdenv.lib.platforms.x86; maintainers = with stdenv.lib.maintainers; [ viric thoughtpolice obadz vrthra ]; license = stdenv.lib.licenses.free; # Combination of LGPL/X11/GPL ? }; diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix index a29056d965ac1..0e676c4201867 100644 --- a/pkgs/development/haskell-modules/generic-builder.nix +++ b/pkgs/development/haskell-modules/generic-builder.nix @@ -34,8 +34,8 @@ in , enableStaticLibraries ? true , extraLibraries ? [], librarySystemDepends ? [], executableSystemDepends ? [] , homepage ? "http://hackage.haskell.org/package/${pname}" -, platforms ? ghc.meta.platforms -, hydraPlatforms ? platforms +, platforms ? with stdenv.lib.platforms; unix ++ windows # GHC can cross-compile +, hydraPlatforms ? null , hyperlinkSource ? true , isExecutable ? false, isLibrary ? !isExecutable , jailbreak ? false @@ -403,7 +403,7 @@ stdenv.mkDerivation ({ // optionalAttrs broken { inherit broken; } // optionalAttrs (description != "") { inherit description; } // optionalAttrs (maintainers != []) { inherit maintainers; } - // optionalAttrs (hydraPlatforms != platforms) { inherit hydraPlatforms; } + // optionalAttrs (hydraPlatforms != null) { inherit hydraPlatforms; } ; } diff --git a/pkgs/development/libraries/buddy/default.nix b/pkgs/development/libraries/buddy/default.nix index 313ac086726ff..00e236eba8c3d 100644 --- a/pkgs/development/libraries/buddy/default.nix +++ b/pkgs/development/libraries/buddy/default.nix @@ -18,7 +18,7 @@ stdenv.mkDerivation rec { description = "Binary decision diagram package"; license = "as-is"; - platforms = with stdenv.lib.platforms; allBut cygwin; + platforms = stdenv.lib.platforms.unix; # Once had cygwin problems maintainers = [ stdenv.lib.maintainers.peti ]; }; } diff --git a/pkgs/development/libraries/cln/default.nix b/pkgs/development/libraries/cln/default.nix index 9d7c9c4f30f85..e39386dca3f43 100644 --- a/pkgs/development/libraries/cln/default.nix +++ b/pkgs/development/libraries/cln/default.nix @@ -15,6 +15,6 @@ stdenv.mkDerivation rec { description = "C/C++ library for numbers, a part of GiNaC"; homepage = http://www.ginac.de/CLN/; maintainers = [ ]; - platforms = with stdenv.lib.platforms; allBut cygwin; + platforms = stdenv.lib.platforms.unix; # Once had cygwin problems }; } diff --git a/pkgs/development/libraries/cloog-ppl/default.nix b/pkgs/development/libraries/cloog-ppl/default.nix index 2c49e0363589f..442b115a40822 100644 --- a/pkgs/development/libraries/cloog-ppl/default.nix +++ b/pkgs/development/libraries/cloog-ppl/default.nix @@ -69,6 +69,6 @@ stdenv.mkDerivation rec { make[3]: *** [Box.lo] Error 1 */ - platforms = with stdenv.lib.platforms; allBut cygwin; + platforms = stdenv.lib.platforms.unix; # Once had cygwin problems }; } diff --git a/pkgs/development/libraries/cloog/0.18.0.nix b/pkgs/development/libraries/cloog/0.18.0.nix index ccd938283199d..fa4e19f716ae8 100644 --- a/pkgs/development/libraries/cloog/0.18.0.nix +++ b/pkgs/development/libraries/cloog/0.18.0.nix @@ -58,6 +58,6 @@ stdenv.mkDerivation rec { make[3]: *** [Box.lo] Error 1 */ - platforms = with stdenv.lib.platforms; allBut cygwin; + platforms = stdenv.lib.platforms.unix; # Once had cygwin problems }; } diff --git a/pkgs/development/libraries/cloog/default.nix b/pkgs/development/libraries/cloog/default.nix index 5da29273a8be7..902e0b26687b9 100644 --- a/pkgs/development/libraries/cloog/default.nix +++ b/pkgs/development/libraries/cloog/default.nix @@ -59,6 +59,6 @@ stdenv.mkDerivation rec { make[3]: *** [Box.lo] Error 1 */ - platforms = with stdenv.lib.platforms; allBut cygwin; + platforms = stdenv.lib.platforms.unix; # Once had cygwin problems }; } diff --git a/pkgs/development/libraries/libatomic_ops/default.nix b/pkgs/development/libraries/libatomic_ops/default.nix index 714e9361440c5..c22fb8a2cba2d 100644 --- a/pkgs/development/libraries/libatomic_ops/default.nix +++ b/pkgs/development/libraries/libatomic_ops/default.nix @@ -26,6 +26,6 @@ stdenv.mkDerivation rec { description = ''A library for semi-portable access to hardware-provided atomic memory update operations''; license = stdenv.lib.licenses.gpl2Plus ; maintainers = [stdenv.lib.maintainers.raskin]; - platforms = stdenv.lib.platforms.unix; + platforms = with stdenv.lib.platforms; unix ++ windows; }; } diff --git a/pkgs/development/libraries/qt-5/modules/qtbase.nix b/pkgs/development/libraries/qt-5/modules/qtbase.nix index 3a0a7326f762c..c6473ff188a72 100644 --- a/pkgs/development/libraries/qt-5/modules/qtbase.nix +++ b/pkgs/development/libraries/qt-5/modules/qtbase.nix @@ -30,7 +30,6 @@ assert withGtk3 -> dconf != null; assert withGtk3 -> gtk3 != null; let - system-x86_64 = lib.elem stdenv.system lib.platforms.x86_64; compareVersion = v: builtins.compareVersions version v; in @@ -258,7 +257,7 @@ stdenv.mkDerivation { "-no-warnings-are-errors" ] ++ ( - if (!system-x86_64) + if (!stdenv.hostPlatform.isx86_64) then [ "-no-sse2" ] else lib.optional (compareVersion "5.9.0" >= 0) [ "-sse2" ] ) diff --git a/pkgs/development/libraries/rocksdb/default.nix b/pkgs/development/libraries/rocksdb/default.nix index 562942f230fb4..6ccb78003cfae 100644 --- a/pkgs/development/libraries/rocksdb/default.nix +++ b/pkgs/development/libraries/rocksdb/default.nix @@ -73,7 +73,7 @@ stdenv.mkDerivation rec { homepage = http://rocksdb.org; description = "A library that provides an embeddable, persistent key-value store for fast storage"; license = licenses.bsd3; - platforms = platforms.allBut [ "i686-linux" ]; + platforms = platforms.x86_64 ++ platforms.aarch64; maintainers = with maintainers; [ adev wkennington ]; }; } diff --git a/pkgs/development/libraries/wiredtiger/default.nix b/pkgs/development/libraries/wiredtiger/default.nix index 9d11b98b1cbd1..c905c40cf9603 100644 --- a/pkgs/development/libraries/wiredtiger/default.nix +++ b/pkgs/development/libraries/wiredtiger/default.nix @@ -15,7 +15,7 @@ let mkWith = mkFlag "with-" "without-"; mkOther = mkFlag "" "" true; - shouldUsePkg = pkg: if pkg != null && any (x: x == stdenv.system) pkg.meta.platforms then pkg else null; + shouldUsePkg = pkg: if pkg != null && pkg.meta.available then pkg else null; optLz4 = shouldUsePkg lz4; optSnappy = shouldUsePkg snappy; diff --git a/pkgs/development/pharo/vm/build-vm-legacy.nix b/pkgs/development/pharo/vm/build-vm-legacy.nix index 66cef77e5a949..f2fd6eebd56eb 100644 --- a/pkgs/development/pharo/vm/build-vm-legacy.nix +++ b/pkgs/development/pharo/vm/build-vm-legacy.nix @@ -70,9 +70,9 @@ stdenv.mkDerivation rec { license = stdenv.lib.licenses.mit; maintainers = [ stdenv.lib.maintainers.lukego ]; # Pharo VM sources are packaged separately for darwin (OS X) - platforms = with stdenv.lib; - intersectLists - platforms.mesaPlatforms - (subtractLists platforms.darwin platforms.unix); + platforms = stdenv.lib.filter + (system: with stdenv.lib.systems.elaborate { inherit system; }; + isUnix && !isDarwin) + stdenv.lib.platforms.mesaPlatforms; }; } diff --git a/pkgs/development/pharo/wrapper/default.nix b/pkgs/development/pharo/wrapper/default.nix index f60b8a6d20386..084c46cd5b51b 100644 --- a/pkgs/development/pharo/wrapper/default.nix +++ b/pkgs/development/pharo/wrapper/default.nix @@ -2,7 +2,7 @@ stdenv.mkDerivation rec { name = "pharo"; - src = ./.; + src = ./pharo-vm.sh; inherit cog32 spur32 spur64 file; magic = ./magic; desktopItem = makeDesktopItem { @@ -17,6 +17,10 @@ stdenv.mkDerivation rec { categories = "Development;"; mimeType = "application/x-pharo-image"; }; + unpackPhase = '' + cp $src ./pharo-vm.sh + sourceRoot=$PWD + ''; buildPhase = '' substituteAllInPlace ./pharo-vm.sh ''; @@ -49,10 +53,10 @@ stdenv.mkDerivation rec { license = stdenv.lib.licenses.mit; maintainers = [ stdenv.lib.maintainers.lukego ]; # Pharo VM sources are packaged separately for darwin (OS X) - platforms = with stdenv.lib; - intersectLists - platforms.mesaPlatforms - (subtractLists platforms.darwin platforms.unix); + platforms = stdenv.lib.filter + (system: with stdenv.lib.systems.elaborate { inherit system; }; + isUnix && !isDarwin) + stdenv.lib.platforms.mesaPlatforms; }; } diff --git a/pkgs/development/tools/rtags/default.nix b/pkgs/development/tools/rtags/default.nix index 13fbea3fc2312..a2c75a02aa28a 100644 --- a/pkgs/development/tools/rtags/default.nix +++ b/pkgs/development/tools/rtags/default.nix @@ -32,6 +32,6 @@ stdenv.mkDerivation rec { description = "C/C++ client-server indexer based on clang"; homepage = https://github.com/andersbakken/rtags; license = stdenv.lib.licenses.gpl3; - platforms = stdenv.lib.platforms.allBut [ "i686-linux" ]; + platforms = with stdenv.lib.platforms; x86_64 ++ aarch64; }; } diff --git a/pkgs/games/endless-sky/default.nix b/pkgs/games/endless-sky/default.nix index 40dbd1d33a77d..8e1bd52eb42fe 100644 --- a/pkgs/games/endless-sky/default.nix +++ b/pkgs/games/endless-sky/default.nix @@ -41,6 +41,6 @@ stdenv.mkDerivation rec { gpl3Plus cc-by-sa-30 cc-by-sa-40 publicDomain ]; maintainers = with maintainers; [ lheckemann ]; - platforms = with platforms; allBut darwin; + platforms = platforms.linux; # Maybe other non-darwin Unix }; } diff --git a/pkgs/games/nethack/default.nix b/pkgs/games/nethack/default.nix index d9ab3ee833b23..b67a79aa3fe77 100644 --- a/pkgs/games/nethack/default.nix +++ b/pkgs/games/nethack/default.nix @@ -2,11 +2,11 @@ let platform = - if lib.elem stdenv.system lib.platforms.unix then "unix" + if stdenv.hostPlatform.isUnix then "unix" else throw "Unknown platform for NetHack: ${stdenv.system}"; unixHint = - if stdenv.isLinux then "linux" - else if stdenv.isDarwin then "macosx10.10" + /**/ if stdenv.hostPlatform.isLinux then "linux" + else if stdenv.hostPlatform.isDarwin then "macosx10.10" # We probably want something different for Darwin else "unix"; userDir = "~/.config/nethack"; diff --git a/pkgs/misc/jackaudio/default.nix b/pkgs/misc/jackaudio/default.nix index a6396fc8c28bf..52b0abc48a7a5 100644 --- a/pkgs/misc/jackaudio/default.nix +++ b/pkgs/misc/jackaudio/default.nix @@ -15,7 +15,7 @@ with stdenv.lib; let inherit (python2Packages) python dbus-python; - shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null; + shouldUsePkg = pkg: if pkg != null && pkg.meta.available then pkg else null; libOnly = prefix == "lib"; diff --git a/pkgs/misc/jackaudio/jack1.nix b/pkgs/misc/jackaudio/jack1.nix index 28ce85bd8a3f0..43d23dd525ae4 100644 --- a/pkgs/misc/jackaudio/jack1.nix +++ b/pkgs/misc/jackaudio/jack1.nix @@ -5,7 +5,7 @@ }: let - shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null; + shouldUsePkg = pkg: if pkg != null && pkg.meta.available then pkg else null; optAlsaLib = shouldUsePkg alsaLib; optDb = shouldUsePkg db; diff --git a/pkgs/misc/screensavers/alock/default.nix b/pkgs/misc/screensavers/alock/default.nix index 1dc03e1e9f032..5b7c12dee1b03 100644 --- a/pkgs/misc/screensavers/alock/default.nix +++ b/pkgs/misc/screensavers/alock/default.nix @@ -38,7 +38,7 @@ stdenv.mkDerivation rec { xscreensaver and never will. It's just for locking the current X session. ''; - platforms = with platforms; allBut cygwin; + platforms = platforms.unix; # Cygwin had problems at one point maintainers = with maintainers; [ ftrvxmtrx chris-martin ]; }; } diff --git a/pkgs/misc/screensavers/xscreensaver/default.nix b/pkgs/misc/screensavers/xscreensaver/default.nix index b337b6cb0e90e..8035e7da37db8 100644 --- a/pkgs/misc/screensavers/xscreensaver/default.nix +++ b/pkgs/misc/screensavers/xscreensaver/default.nix @@ -50,7 +50,7 @@ stdenv.mkDerivation rec { homepage = https://www.jwz.org/xscreensaver/; description = "A set of screensavers"; maintainers = with stdenv.lib.maintainers; [ raskin ]; - platforms = with stdenv.lib.platforms; allBut cygwin; + platforms = stdenv.lib.platforms.unix; # Once had cygwin problems inherit version; downloadPage = "https://www.jwz.org/xscreensaver/download.html"; updateWalker = true; diff --git a/pkgs/os-specific/linux/ffado/default.nix b/pkgs/os-specific/linux/ffado/default.nix index 4e2d2b388419d..4e3e373d244c7 100644 --- a/pkgs/os-specific/linux/ffado/default.nix +++ b/pkgs/os-specific/linux/ffado/default.nix @@ -11,7 +11,7 @@ let - shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null; + shouldUsePkg = pkg: if pkg != null && pkg.meta.available then pkg else null; libOnly = prefix == "lib"; diff --git a/pkgs/servers/http/nginx/generic.nix b/pkgs/servers/http/nginx/generic.nix index de30870bee834..ff0a4c65b4a60 100644 --- a/pkgs/servers/http/nginx/generic.nix +++ b/pkgs/servers/http/nginx/generic.nix @@ -55,7 +55,7 @@ stdenv.mkDerivation { "--with-mail_ssl_module" ] ++ optional (gd != null) "--with-http_image_filter_module" - ++ optional (elem stdenv.system (with platforms; linux ++ freebsd)) "--with-file-aio" + ++ optional (with stdenv.hostPlatform; isLinux || isFreeBSD) "--with-file-aio" ++ map (mod: "--add-module=${mod.src}") modules; NIX_CFLAGS_COMPILE = [ "-I${libxml2.dev}/include/libxml2" ] ++ optional stdenv.isDarwin "-Wno-error=deprecated-declarations"; diff --git a/pkgs/servers/shishi/default.nix b/pkgs/servers/shishi/default.nix index 535571f46e201..1540a6f1fd18d 100644 --- a/pkgs/servers/shishi/default.nix +++ b/pkgs/servers/shishi/default.nix @@ -14,7 +14,7 @@ let mkWith = mkFlag "with-" "without-"; mkOther = mkFlag "" "" true; - shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null; + shouldUsePkg = pkg: if pkg != null && pkg.meta.available then pkg else null; optPam = shouldUsePkg pam; optLibidn = shouldUsePkg libidn; diff --git a/pkgs/stdenv/generic/check-meta.nix b/pkgs/stdenv/generic/check-meta.nix index a1878dc01367f..113b95f3ab00c 100644 --- a/pkgs/stdenv/generic/check-meta.nix +++ b/pkgs/stdenv/generic/check-meta.nix @@ -1,11 +1,9 @@ # Checks derivation meta and attrs for problems (like brokenness, # licenses, etc). -{ lib, config, system, meta, derivationArg, mkDerivationArg }: +{ lib, config, hostPlatform, meta }: let - attrs = mkDerivationArg; # TODO: probably get rid of passing this one - # See discussion at https://github.com/NixOS/nixpkgs/pull/25304#issuecomment-298385426 # for why this defaults to false, but I (@copumpkin) want to default it to true soon. shouldCheckMeta = config.checkMeta or false; @@ -123,7 +121,7 @@ let ''; - handleEvalIssue = { reason , errormsg ? "" }: + handleEvalIssue = attrs: { reason , errormsg ? "" }: let msg = '' Package ‘${attrs.name or "«name-missing»"}’ in ${pos_str} ${errormsg}, refusing to evaluate. @@ -146,7 +144,7 @@ let license = either (listOf lib.types.attrs) (either lib.types.attrs str); maintainers = listOf (attrsOf str); priority = int; - platforms = listOf str; + platforms = listOf (either str lib.systems.parsed.types.system); hydraPlatforms = listOf str; broken = bool; @@ -175,6 +173,9 @@ 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: + lib.any (lib.meta.platformMatch hostPlatform) attrs.meta.platforms; + # Check if a derivation is valid, that is whether it passes checks for # e.g brokenness or license. # @@ -188,19 +189,21 @@ 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 && !allowBroken && attrs.meta.platforms or null != null && !lib.lists.elem system attrs.meta.platforms then - { valid = false; reason = "broken"; errormsg = "is not supported on ‘${system}’"; } + else if !allowUnsupportedSystem && !allowBroken && attrs.meta.platforms or null != null && !(checkPlatform attrs) then + { valid = false; reason = "broken"; errormsg = "is not supported on ‘${hostPlatform.config}’"; } else if !(hasAllowedInsecure attrs) then { valid = false; reason = "insecure"; errormsg = "is marked as insecure"; } else let res = checkMeta (attrs.meta or {}); in if res != [] then { valid = false; reason = "unknown-meta"; errormsg = "has an invalid meta attrset:${lib.concatMapStrings (x: "\n\t - " + x) res}"; } else { valid = true; }; - validity = checkValidity attrs; + assertValidity = attrs: let + validity = checkValidity attrs; + in validity // { + # Throw an error if trying to evaluate an non-valid derivation + handled = if !validity.valid + then handleEvalIssue attrs (removeAttrs validity ["valid"]) + else true; + }; -in validity // { - # Throw an error if trying to evaluate an non-valid derivation - handled = if !validity.valid - then handleEvalIssue (removeAttrs validity ["valid"]) - else true; -} +in assertValidity diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index e8f78d7401f1e..46df958b83967 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -204,12 +204,11 @@ rec { }); validity = import ./check-meta.nix { - inherit lib config meta derivationArg; - mkDerivationArg = attrs; + inherit lib config meta; # Nix itself uses the `system` field of a derivation to decide where # to build it. This is a bit confusing for cross compilation. - inherit (stdenv) system; - }; + inherit (stdenv) hostPlatform; + } attrs; # The meta attribute is passed in the resulting attribute set, # but it's not part of the actual derivation, i.e., it's not diff --git a/pkgs/tools/cd-dvd/dvdisaster/default.nix b/pkgs/tools/cd-dvd/dvdisaster/default.nix index e70d259df6835..590c32188141e 100644 --- a/pkgs/tools/cd-dvd/dvdisaster/default.nix +++ b/pkgs/tools/cd-dvd/dvdisaster/default.nix @@ -33,8 +33,7 @@ stdenv.mkDerivation rec { "--docdir=share/doc" "--with-nls=yes" "--with-embedded-src-path=no" - ] ++ stdenv.lib.optional (builtins.elem stdenv.system - stdenv.lib.platforms.x86_64) "--with-sse2=yes"; + ] ++ stdenv.lib.optional (stdenv.hostPlatform.isx86_64) "--with-sse2=yes"; # fatal error: inlined-icons.h: No such file or directory enableParallelBuilding = false; diff --git a/pkgs/tools/filesystems/ceph/generic.nix b/pkgs/tools/filesystems/ceph/generic.nix index 764f082aa899f..66d74ff5cf736 100644 --- a/pkgs/tools/filesystems/ceph/generic.nix +++ b/pkgs/tools/filesystems/ceph/generic.nix @@ -37,8 +37,7 @@ with stdenv.lib; let shouldUsePkg = pkg_: let pkg = (builtins.tryEval pkg_).value; - in if lib.any (x: x == system) (pkg.meta.platforms or []) - then pkg else null; + in if pkg.meta.available or false then pkg else null; optYasm = shouldUsePkg yasm; optFcgi = shouldUsePkg fcgi; diff --git a/pkgs/tools/graphics/barcode/default.nix b/pkgs/tools/graphics/barcode/default.nix index d6a31bd5c7f7d..7ed2cc8b6aaf5 100644 --- a/pkgs/tools/graphics/barcode/default.nix +++ b/pkgs/tools/graphics/barcode/default.nix @@ -14,7 +14,7 @@ stdenv.mkDerivation rec { meta = with stdenv.lib; { description = "GNU barcode generator"; maintainers = with maintainers; [ raskin ]; - platforms = with platforms; allBut darwin; + platforms = platforms.linux; # Maybe other non-darwin Unix downloadPage = "http://ftp.gnu.org/gnu/barcode/"; updateWalker = true; homepage = http://ftp.gnu.org/gnu/barcode/; diff --git a/pkgs/tools/graphics/dcraw/default.nix b/pkgs/tools/graphics/dcraw/default.nix index 66d3a1100804b..30546865bcc11 100644 --- a/pkgs/tools/graphics/dcraw/default.nix +++ b/pkgs/tools/graphics/dcraw/default.nix @@ -23,7 +23,7 @@ stdenv.mkDerivation rec { homepage = http://www.cybercom.net/~dcoffin/dcraw/; description = "Decoder for many camera raw picture formats"; license = stdenv.lib.licenses.free; - platforms = with stdenv.lib.platforms; allBut cygwin; + platforms = stdenv.lib.platforms.unix; # Once had cygwin problems maintainers = [ ]; }; } diff --git a/pkgs/tools/misc/mbuffer/default.nix b/pkgs/tools/misc/mbuffer/default.nix index e81fa7958b5c9..ed6c08d555458 100644 --- a/pkgs/tools/misc/mbuffer/default.nix +++ b/pkgs/tools/misc/mbuffer/default.nix @@ -18,6 +18,6 @@ stdenv.mkDerivation rec { description = "A tool for buffering data streams with a large set of unique features"; license = stdenv.lib.licenses.gpl3; maintainers = with stdenv.lib.maintainers; [ tokudan ]; - platforms = with stdenv.lib.platforms; allBut darwin; + platforms = stdenv.lib.platforms.linux; # Maybe other non-darwin Unix }; } diff --git a/pkgs/tools/networking/dnscrypt-proxy/default.nix b/pkgs/tools/networking/dnscrypt-proxy/default.nix index 95bfdca6315a3..6120b821bf412 100644 --- a/pkgs/tools/networking/dnscrypt-proxy/default.nix +++ b/pkgs/tools/networking/dnscrypt-proxy/default.nix @@ -32,6 +32,6 @@ stdenv.mkDerivation rec { license = licenses.isc; maintainers = with maintainers; [ joachifm jgeerds ]; # upstream claims OSX support, but Hydra fails - platforms = with platforms; allBut darwin; + platforms = platforms.linux; # Maybe other non-darwin Unix }; } diff --git a/pkgs/tools/networking/zerotierone/default.nix b/pkgs/tools/networking/zerotierone/default.nix index 37812029c96ca..77df8cbf6f7dc 100644 --- a/pkgs/tools/networking/zerotierone/default.nix +++ b/pkgs/tools/networking/zerotierone/default.nix @@ -39,6 +39,6 @@ stdenv.mkDerivation rec { homepage = https://www.zerotier.com; license = licenses.gpl3; maintainers = with maintainers; [ sjmackenzie zimbatm ehmry ]; - platforms = platforms.allBut [ "i686-linux" ]; + platforms = platforms.x86_64 ++ platforms.aarch64; }; } diff --git a/pkgs/top-level/default.nix b/pkgs/top-level/default.nix index 9cf9eb4db658a..da7fc1bed34c5 100644 --- a/pkgs/top-level/default.nix +++ b/pkgs/top-level/default.nix @@ -22,9 +22,9 @@ # `*Platform`s. localSystem - # The system packages will ultimately be run on. Null if the two should be the +, # The system packages will ultimately be run on. Null if the two should be the # same. -, crossSystem ? null + crossSystem ? null , # Allow a configuration attribute set to be passed in as an argument. config ? {} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index df5698a31d2a8..ca44b4598ee9e 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -12987,7 +12987,7 @@ in { homepage = https://pypi.python.org/pypi/PyICU/; description = "Python extension wrapping the ICU C++ API"; license = licenses.mit; - platforms = with platforms; allBut darwin; + platforms = platforms.linux; # Maybe other non-darwin Unix maintainers = [ maintainers.rycee ]; }; }; diff --git a/pkgs/top-level/release-cross.nix b/pkgs/top-level/release-cross.nix index ef99dbd619e4a..0d15d817a66c1 100644 --- a/pkgs/top-level/release-cross.nix +++ b/pkgs/top-level/release-cross.nix @@ -88,7 +88,7 @@ in f (["buildPackages"] ++ path) { inherit system crossSystem; } ); - testEqual = path: systems: forTheseSystems systems (testEqualOne path); + testEqual = path: systems: forMatchingSystems systems (testEqualOne path); mapTestEqual = lib.mapAttrsRecursive testEqual; diff --git a/pkgs/top-level/release-lib.nix b/pkgs/top-level/release-lib.nix index 87fb00a9682d4..623c9d9cb000e 100644 --- a/pkgs/top-level/release-lib.nix +++ b/pkgs/top-level/release-lib.nix @@ -48,33 +48,56 @@ rec { pkgs_x86_64_cygwin = allPackages { system = "x86_64-cygwin"; }; + # Given a list of 'meta.platforms'-style patterns, return the sublist of + # `supportedSystems` containing systems that matches at least one of the given + # patterns. + # + # This is written in a funny way so that we only elaborate the systems once. + supportedMatches = let + supportedPlatforms = map + (system: lib.systems.elaborate { inherit system; }) + supportedSystems; + in metaPatterns: let + anyMatch = platform: + lib.any (lib.meta.platformMatch platform) metaPatterns; + matchingPlatforms = lib.filter anyMatch supportedPlatforms; + in map ({ system, ...}: system) matchingPlatforms; + + assertTrue = bool: if bool then pkgs.runCommand "evaluated-to-true" {} "touch $out" else pkgs.runCommand "evaluated-to-false" {} "false"; + /* The working or failing mails for cross builds will be sent only to the following maintainers, as most package maintainers will not be interested in the result of cross building a package. */ crossMaintainers = [ maintainers.viric ]; + + # Generate attributes for all supported systems. forAllSystems = genAttrs supportedSystems; - forTheseSystems = systems: f: - genAttrs (filter (x: elem x supportedSystems) systems) f; + + + # Generate attributes for all sytems matching at least one of the given + # patterns + forMatchingSystems = metaPatterns: genAttrs (supportedMatches metaPatterns); + /* Build a package on the given set of platforms. The function `f' is called for each supported platform with Nixpkgs for that platform as an argument . We return an attribute set containing a derivation for each supported platform, i.e. ‘{ x86_64-linux = f pkgs_x86_64_linux; i686-linux = f pkgs_i686_linux; ... }’. */ - testOn = systems: f: forTheseSystems systems + testOn = metaPatterns: f: forMatchingSystems metaPatterns (system: hydraJob' (f (pkgsFor system))); /* Similar to the testOn function, but with an additional 'crossSystem' parameter for allPackages, defining the target platform for cross builds. */ - testOnCross = crossSystem: systems: f: forTheseSystems systems + testOnCross = crossSystem: metaPatterns: f: forMatchingSystems metaPatterns (system: hydraJob' (f (allPackages { inherit system crossSystem; }))); @@ -82,14 +105,14 @@ rec { map each leaf node to `testOn [platforms...] (pkgs: pkgs.)'. */ mapTestOn = mapAttrsRecursive - (path: systems: testOn systems (pkgs: getAttrFromPath path pkgs)); + (path: metaPatterns: testOn metaPatterns (pkgs: getAttrFromPath path pkgs)); /* Similar to the testOn function, but with an additional 'crossSystem' * parameter for allPackages, defining the target platform for cross builds, * and triggering the build of the host derivation (cross built - crossDrv). */ mapTestOnCross = crossSystem: mapAttrsRecursive - (path: systems: testOnCross crossSystem systems + (path: metaPatterns: testOnCross crossSystem metaPatterns (pkgs: addMetaAttrs { maintainers = crossMaintainers; } (getAttrFromPath path pkgs))); @@ -98,7 +121,8 @@ rec { packagePlatforms = mapAttrs (name: value: let res = builtins.tryEval ( if isDerivation value then - value.meta.hydraPlatforms or (value.meta.platforms or [ "x86_64-linux" ]) + value.meta.hydraPlatforms + or (supportedMatches (value.meta.platforms or [ "x86_64-linux" ])) else if value.recurseForDerivations or false || value.recurseForRelease or false then packagePlatforms value else @@ -108,7 +132,7 @@ rec { /* Common platform groups on which to test packages. */ - inherit (platforms) unix linux darwin cygwin allBut all mesaPlatforms; + inherit (platforms) unix linux darwin cygwin all mesaPlatforms; /* Platform groups for specific kinds of applications. */ x11Supported = linux; diff --git a/pkgs/top-level/release-small.nix b/pkgs/top-level/release-small.nix index 391d79e47f18f..e92ad47e1425e 100644 --- a/pkgs/top-level/release-small.nix +++ b/pkgs/top-level/release-small.nix @@ -21,7 +21,7 @@ with import ./release-lib.nix { inherit supportedSystems; }; atlas = linux; autoconf = all; automake = all; - avahi = allBut cygwin; # Cygwin builds fail + avahi = unix; # Cygwin builds fail bash = all; bashInteractive = all; bc = all; @@ -54,7 +54,7 @@ with import ./release-lib.nix { inherit supportedSystems; }; gnumake = all; gnupatch = all; gnupg = linux; - gnuplot = allBut cygwin; + gnuplot = unix; # Cygwin builds fail gnused = all; gnutar = all; gnutls = linux; @@ -128,7 +128,7 @@ with import ./release-lib.nix { inherit supportedSystems; }; pkgconfig = all; pmccabe = linux; procps = linux; - python = allBut cygwin; + python = unix; # Cygwin builds fail readline = all; rlwrap = all; rpm = linux; @@ -138,9 +138,9 @@ with import ./release-lib.nix { inherit supportedSystems; }; scrot = linux; sdparm = linux; sharutils = all; - sloccount = allBut cygwin; + sloccount = unix; # Cygwin builds fail smartmontools = all; - sqlite = allBut cygwin; + sqlite = unix; # Cygwin builds fail squid = linux; ssmtp = linux; stdenv = all;