nur @main -
refs -
log -
-
https://git.jolheiser.com/nur.git
Signature
-----BEGIN PGP SIGNATURE-----
wsBcBAABCAAQBQJcobH8CRBK7hj4Ov3rIwAAdHIIAGiDwU2yIXs5FBA6KqukeQzS
FYP1p6+LqVfcT2x1a8wQbuMveLcCSkyeBl++knBwOn5mogZjDI85h0hFfdwJu1BI
ePcjuNf3Xb9x2Q2CR6flXE5epPrcQEs+IObTU0bLmW+FVaZO+rOE+0++FB39ExVP
YeEKK2oBUPN/1eId9z6DOqzJHKCX2icmFzMsN0aPseKPceQxmMcyOLPGjLMEvJXy
7M2qzjozFG0o0ZlBWdsNA+KcvfbjzS+kwCBqWKZAZrcYdjn8PKSf9t8yvd6LfiDU
o04yV9Jgx4E6E9WDy2zfR2XzUuzPwUc52mvZgKngExqLg/azxKkRGAfxLGSfI9E=
=yOF3
-----END PGP SIGNATURE-----
diff --git a/.travis.yml b/.travis.yml
index e1d61177407fc115c950385483068fd97cb83c2a..806571785f36b761b4512ec131f9f682e3bbb6e7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -23,13 +23,13 @@ - travis_retry nix-channel --update
script:
-language: nix
+ include:
- nix eval -f default.nix 'lib'
- nix eval -f default.nix 'modules'
- nix eval -f default.nix 'overlays'
after_success:
- - if [ -n "${CACHIX_CACHE}" ]; then cachix push "${CACHIX_CACHE}" $outs; fi
+ - if [ -n "${CACHIX_CACHE}" ]; then nix-build ci.nix -A cacheOutputs | cachix push "${CACHIX_CACHE}"; fi
- if [ "false" = "${TRAVIS_PULL_REQUEST}" -a "master" = "${TRAVIS_BRANCH}" ]; then
curl -XPOST "https://nur-update.herokuapp.com/update?repo=${NUR_REPO}"; fi
diff --git a/buildable.nix b/buildable.nix
deleted file mode 100644
index 2b61b1f7627f912a2597c1369e0cd97f7c27eac4..0000000000000000000000000000000000000000
--- a/buildable.nix
+++ /dev/null
@@ -1,28 +0,0 @@
-# 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; })
-
diff --git a/ci.nix b/ci.nix
new file mode 100644
index 0000000000000000000000000000000000000000..1377d43c00b1506533358c9e0fc17901b6c8e12a
--- /dev/null
+++ b/ci.nix
@@ -0,0 +1,56 @@
+# This file provides all the buildable and cacheable packages and
+# package outputs in you package set. These are what gets built by CI,
+# so if you correctly mark packages as
+#
+# - broken (using `meta.broken`),
+# - unfree (using `meta.license.free`), and
+# - locally built (using `preferLocalBuild`)
+#
+# then your CI will be able to build and cache only those packages for
+# which this is possible.
+
+{ pkgs ? import <nixpkgs> {} }:
+
+with builtins;
+
+let
+
+ isReserved = n: n == "lib" || n == "overlays" || n == "modules";
+ isDerivation = p: isAttrs p && p ? type && p.type == "derivation";
+ isBuildable = p: !(p.meta.broken or false) && p.meta.license.free or false;
+ isCacheable = p: !(p.preferLocalBuild or false);
+ shouldRecurseForDerivations = p: isAttrs p && p.recurseForDerivations or false;
+
+ nameValuePair = n: v: { name = n; value = v; };
+
+ concatMap = builtins.concatMap or (f: xs: concatLists (map f xs));
+
+ flattenPkgs = s:
+ let
+ f = p:
+ if shouldRecurseForDerivations p then flattenPkgs p
+ else if isDerivation p then [p]
+ else [];
+ in
+ concatMap f (attrValues s);
+
+ outputsOf = p: map (o: p.${o}) p.outputs;
+
+ nurAttrs = import ./default.nix { inherit pkgs; };
+
+ nurPkgs =
+ flattenPkgs
+ (listToAttrs
+ (map (n: nameValuePair n nurAttrs.${n})
+ (filter (n: !isReserved n)
+ (attrNames nurAttrs))));
+
+in
+
+rec {
+ buildPkgs = filter isBuildable nurPkgs;
+ cachePkgs = filter isCacheable buildPkgs;
+
+ buildOutputs = concatMap outputsOf buildPkgs;
+ cacheOutputs = concatMap outputsOf cachePkgs;
+}
diff --git a/overlay.nix b/overlay.nix
index bda4332a081fcd8c713733a27a02f0dc312cd32c..122729de0fdc9ac97ec903c039bb438d92958ad6 100644
--- a/overlay.nix
+++ b/overlay.nix
@@ -1,29 +1,26 @@
-# You can use this file as a nixpkgs overlay.
+# It's useful in the case where you don't want to add the whole NUR namespace
# It's useful in the case where you don't want to add the whole NUR namespace
+# It's useful in the case where you don't want to add the whole NUR namespace
# to your configuration.
+# configuration.
self: super:
let
- filterSet =
- (f: g: s: builtins.listToAttrs
- (map
- (n: { name = n; value = builtins.getAttr n s; })
- (builtins.filter
+
-# You can use this file as a nixpkgs overlay.
# It's useful in the case where you don't want to add the whole NUR namespace
- (builtins.attrNames s)
- )
-# You can use this file as a nixpkgs overlay.
self: super:
-# You can use this file as a nixpkgs overlay.
+# It's useful in the case where you don't want to add the whole NUR namespace
let
-# You can use this file as a nixpkgs overlay.
+# It's useful in the case where you don't want to add the whole NUR namespace
filterSet =
-# You can use this file as a nixpkgs overlay.
+
+# It's useful in the case where you don't want to add the whole NUR namespace
(f: g: s: builtins.listToAttrs
- (n: !(isReserved n)) # filter out non-packages
+
# It's useful in the case where you don't want to add the whole NUR namespace
+ (map
+# to your configuration.
-# It's useful in the case where you don't want to add the whole NUR namespace
+# to your configuration.
# You can use this file as a nixpkgs overlay.
-
+ (builtins.attrNames nurAttrs)))