From 3ff4550a66be41ea42dfdd0393744623d00c0559 Mon Sep 17 00:00:00 2001 From: Sergey Vlasov Date: Fri, 24 Jun 2022 00:01:45 +0300 Subject: [PATCH 1/3] filterPackages: Add support for meta.badPlatforms Since https://www.github.com/NixOS/nixpkgs/pull/37803 Nixpkgs supports using meta.badPlatforms to specify a list of platforms which are not supported by the package despite being included in meta.platforms. Modify filterPackages to honor these platform restrictions. --- filterPackages.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/filterPackages.nix b/filterPackages.nix index 5bd4eba..614db0d 100644 --- a/filterPackages.nix +++ b/filterPackages.nix @@ -22,10 +22,12 @@ let isDerivation = x: isAttrs x && x ? type && x.type == "derivation"; isBroken = meta.broken or false; platforms = meta.hydraPlatforms or meta.platforms or allSystems; + badPlatforms = meta.badPlatforms or [ ]; in # check for isDerivation, so this is independently useful of # flattenTree, which also does filter on derviations - isDerivation v && !isBroken && builtins.elem system platforms + isDerivation v && !isBroken && (builtins.elem system platforms) && + !(builtins.elem system badPlatforms) ; in filterAttrs sieve packages From 3b6a41d794bf4217b353f8b5477f903841a300fb Mon Sep 17 00:00:00 2001 From: Sergey Vlasov Date: Fri, 24 Jun 2022 00:07:55 +0300 Subject: [PATCH 2/3] filterPackages: Do not use meta.hydraPlatforms for filtering The meta.hydraPlatforms attribute was never intended to mark the package broken; actually lots of packages have `meta.hydraPlatforms = []` while being perfectly usable. Typical reasons for disabling Hydra builds are: - the package build process is so trivial that caching the build results on Hydra won't be useful (this often applies to wrapper packages, or some packages which contain just prebuilt data or binaries); - the package build process exceeds Hydra limits; - the package is impure and depends on some proprietary software installed on the build host (this is the case with some Darwin-specific packages that require Xcode to build); - the package license does not allow redistribution of binaries (which also may need to be modified to work with Nix, and many proprietary licenses don't allow redistribution of such modified binaries); although this should normally be handled with meta.unfree. Especially the first case (wrapper packages) hits some important packages (firefox, neovim). Remove the usage of meta.hydraPlatforms from the filterPackages code, so that the filtering performed by that function would match the actual platform restriction of packages (meta.platforms and meta.badPlatforms). --- filterPackages.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/filterPackages.nix b/filterPackages.nix index 614db0d..3bc3e47 100644 --- a/filterPackages.nix +++ b/filterPackages.nix @@ -21,7 +21,7 @@ let inherit (builtins) isAttrs; isDerivation = x: isAttrs x && x ? type && x.type == "derivation"; isBroken = meta.broken or false; - platforms = meta.hydraPlatforms or meta.platforms or allSystems; + platforms = meta.platforms or allSystems; badPlatforms = meta.badPlatforms or [ ]; in # check for isDerivation, so this is independently useful of From 32dc3d46b2854de460e1a0d03cea472fafea5acd Mon Sep 17 00:00:00 2001 From: Sergey Vlasov Date: Fri, 24 Jun 2022 00:32:04 +0300 Subject: [PATCH 3/3] filterPackages: Fix a typo in the comment --- filterPackages.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/filterPackages.nix b/filterPackages.nix index 3bc3e47..b5f2c58 100644 --- a/filterPackages.nix +++ b/filterPackages.nix @@ -25,7 +25,7 @@ let badPlatforms = meta.badPlatforms or [ ]; in # check for isDerivation, so this is independently useful of - # flattenTree, which also does filter on derviations + # flattenTree, which also does filter on derivations isDerivation v && !isBroken && (builtins.elem system platforms) && !(builtins.elem system badPlatforms) ;