nur/buildable.nix

29 lines
879 B
Nix
Raw Normal View History

2019-03-23 18:13:30 +00:00
# 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> {} }:
2019-03-23 18:03:43 +00:00
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)
)
2019-03-23 18:03:43 +00:00
)
);
isReserved = n: builtins.elem n ["lib" "overlays" "modules"];
2019-03-23 18:23:02 +00:00
isBroken = p: p.meta.broken or false;
isFree = p: p.meta.license.free or true;
in filterSet
2019-03-23 18:03:43 +00:00
(n: !(isReserved n)) # filter out non-packages
(p: (builtins.isAttrs p)
2019-03-23 18:03:43 +00:00
&& !(isBroken p)
2019-03-23 18:05:38 +00:00
&& isFree p
)
(import ./default.nix { inherit pkgs; })