From b543720b25df6ffdfcf9227afafc5b8c1fabfae8 Mon Sep 17 00:00:00 2001 From: Pacman99 Date: Tue, 11 May 2021 12:05:05 -0700 Subject: [PATCH] filterPackages: add fallbacks for missing attrs (#32) Co-authored-by: Pacman99 --- default.nix | 2 +- filterPackages.nix | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/default.nix b/default.nix index 79d725f..f81a59c 100644 --- a/default.nix +++ b/default.nix @@ -119,7 +119,7 @@ let # { # hello = «derivation»; # } - filterPackages = system: packages: import ./filterPackages.nix system packages; + filterPackages = import ./filterPackages.nix { inherit allSystems; }; # Returns the structure used by `nix app` mkApp = diff --git a/filterPackages.nix b/filterPackages.nix index a4eac53..6cd935d 100644 --- a/filterPackages.nix +++ b/filterPackages.nix @@ -1,3 +1,4 @@ +{ allSystems }: system: packages: let # Adopted from nixpkgs.lib @@ -18,11 +19,12 @@ let let inherit (builtins) isAttrs; isDerivation = x: isAttrs x && x ? type && x.type == "derivation"; - platforms = meta.hydraPlatforms or meta.platforms or [ ]; + isBroken = meta.broken or false; + platforms = meta.hydraPlatforms or meta.platforms or allSystems; in # check for isDerivation, so this is independently useful of # flattenTree, which also does filter on derviations - isDerivation v && !meta.broken && builtins.elem system platforms + isDerivation v && !isBroken && builtins.elem system platforms ; in filterAttrs sieve packages