From 1110dde8dcdb9979bfe9481ac8722f175640e035 Mon Sep 17 00:00:00 2001 From: Francesco Gazzetta Date: Sat, 23 Mar 2019 19:03:43 +0100 Subject: [PATCH 1/5] Clean up the filtering --- non-broken.nix | 29 ++++++++++++++--------------- overlay.nix | 22 ++++++++++++---------- 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/non-broken.nix b/non-broken.nix index b9a2cf9..35778c2 100644 --- a/non-broken.nix +++ b/non-broken.nix @@ -4,24 +4,23 @@ # be added to the cache. { pkgs ? import {} }: -let filterSet = - (f: g: s: builtins.listToAttrs - (map - (n: { name = n; value = builtins.getAttr n s; }) - (builtins.filter - (n: f n && g (builtins.getAttr n s)) - (builtins.attrNames s) - ) +let + filterSet = + (f: g: s: builtins.listToAttrs + (map + (n: { name = n; value = builtins.getAttr n s; }) + (builtins.filter + (n: f n && g (builtins.getAttr n s)) + (builtins.attrNames s) ) - ); + ) + ); + isReserved = n: builtins.elem n ["lib" "overlays" "modules"]; + isBroken = p: ({ meta.broken = false; } // p).meta.broken; in filterSet - (n: !(n=="lib"||n=="overlays"||n=="modules")) # filter out non-packages + (n: !(isReserved n)) # filter out non-packages (p: (builtins.isAttrs p) - && !( - (builtins.hasAttr "meta" p) - && (builtins.hasAttr "broken" p.meta) - && (p.meta.broken) - ) + && !(isBroken p) ) (import ./default.nix { inherit pkgs; }) diff --git a/overlay.nix b/overlay.nix index 082b038..bda4332 100644 --- a/overlay.nix +++ b/overlay.nix @@ -4,18 +4,20 @@ self: super: -let filterSet = - (f: g: s: builtins.listToAttrs - (map - (n: { name = n; value = builtins.getAttr n s; }) - (builtins.filter - (n: f n && g (builtins.getAttr n s)) - (builtins.attrNames s) - ) +let + filterSet = + (f: g: s: builtins.listToAttrs + (map + (n: { name = n; value = builtins.getAttr n s; }) + (builtins.filter + (n: f n && g (builtins.getAttr n s)) + (builtins.attrNames s) ) - ); + ) + ); + isReserved = n: builtins.elem n ["lib" "overlays" "modules"]; in filterSet - (n: !(n=="lib"||n=="overlays"||n=="modules")) # filter out non-packages + (n: !(isReserved n)) # filter out non-packages (p: true) # all packages are ok (import ./default.nix { pkgs = super; }) From f751ec55c73b506faa023e7684cdc4a05bef9415 Mon Sep 17 00:00:00 2001 From: Francesco Gazzetta Date: Sat, 23 Mar 2019 19:05:19 +0100 Subject: [PATCH 2/5] Rename non-broken --- .travis.yml | 2 +- non-broken.nix => buildable.nix | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename non-broken.nix => buildable.nix (100%) diff --git a/.travis.yml b/.travis.yml index 66ece26..e1d6117 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,7 @@ install: - travis_retry nix-channel --update script: - - outs=$(nix-build non-broken.nix) && echo Produced $outs + - outs=$(nix-build buildable.nix) && echo Produced $outs - nix eval -f default.nix 'lib' - nix eval -f default.nix 'modules' - nix eval -f default.nix 'overlays' diff --git a/non-broken.nix b/buildable.nix similarity index 100% rename from non-broken.nix rename to buildable.nix From 23f67915d12aaf0759b022a4c47b730b4687b7d2 Mon Sep 17 00:00:00 2001 From: Francesco Gazzetta Date: Sat, 23 Mar 2019 19:05:38 +0100 Subject: [PATCH 3/5] Only build free packages --- buildable.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/buildable.nix b/buildable.nix index 35778c2..21af140 100644 --- a/buildable.nix +++ b/buildable.nix @@ -17,10 +17,12 @@ let ); isReserved = n: builtins.elem n ["lib" "overlays" "modules"]; isBroken = p: ({ meta.broken = false; } // p).meta.broken; + isFree = p: ({ meta.license.free = true; } // p).meta.license.free; in filterSet (n: !(isReserved n)) # filter out non-packages (p: (builtins.isAttrs p) && !(isBroken p) + && isFree p ) (import ./default.nix { inherit pkgs; }) From c57e61235d5b74fc7ef508d3ce4315e0842d6c31 Mon Sep 17 00:00:00 2001 From: Francesco Gazzetta Date: Sat, 23 Mar 2019 19:13:30 +0100 Subject: [PATCH 4/5] Wording --- buildable.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/buildable.nix b/buildable.nix index 21af140..9445e5f 100644 --- a/buildable.nix +++ b/buildable.nix @@ -1,6 +1,6 @@ -# This file filters out all the broken packages from your package set. -# It's what gets built by CI, so if you correctly mark broken packages as -# broken your CI will not try to build them and the non-broken packages will +# This file filters out all the unbuildable packages from your package set. +# It's what gets built by CI, so if you correctly mark broken/unfree packages +# as such your CI will not try to build them and the buildable packages will # be added to the cache. { pkgs ? import {} }: From 6ad0281a198f7084ce9857931ab99e119a3682c9 Mon Sep 17 00:00:00 2001 From: Francesco Gazzetta Date: Sat, 23 Mar 2019 19:23:02 +0100 Subject: [PATCH 5/5] Use 'or' syntax --- buildable.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildable.nix b/buildable.nix index 9445e5f..2b61b1f 100644 --- a/buildable.nix +++ b/buildable.nix @@ -16,8 +16,8 @@ let ) ); isReserved = n: builtins.elem n ["lib" "overlays" "modules"]; - isBroken = p: ({ meta.broken = false; } // p).meta.broken; - isFree = p: ({ meta.license.free = true; } // p).meta.license.free; + isBroken = p: p.meta.broken or false; + isFree = p: p.meta.license.free or true; in filterSet (n: !(isReserved n)) # filter out non-packages (p: (builtins.isAttrs p)