Merge pull request #5 from nix-community/only-build-free
Only build free packages
This commit is contained in:
commit
1ab421bfa7
4 changed files with 41 additions and 38 deletions
|
@ -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'
|
||||
|
|
28
buildable.nix
Normal file
28
buildable.nix
Normal file
|
@ -0,0 +1,28 @@
|
|||
# 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 <nixpkgs> {} }:
|
||||
|
||||
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: 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)
|
||||
&& !(isBroken p)
|
||||
&& isFree p
|
||||
)
|
||||
(import ./default.nix { inherit pkgs; })
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
# 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
|
||||
# be added to the cache.
|
||||
{ pkgs ? import <nixpkgs> {} }:
|
||||
|
||||
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)
|
||||
)
|
||||
)
|
||||
);
|
||||
in filterSet
|
||||
(n: !(n=="lib"||n=="overlays"||n=="modules")) # filter out non-packages
|
||||
(p: (builtins.isAttrs p)
|
||||
&& !(
|
||||
(builtins.hasAttr "meta" p)
|
||||
&& (builtins.hasAttr "broken" p.meta)
|
||||
&& (p.meta.broken)
|
||||
)
|
||||
)
|
||||
(import ./default.nix { inherit pkgs; })
|
||||
|
22
overlay.nix
22
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; })
|
||||
|
||||
|
|
Loading…
Reference in a new issue