aboutsummaryrefslogtreecommitdiffhomepage
path: root/ci.nix
diff options
context:
space:
mode:
Diffstat (limited to 'ci.nix')
-rw-r--r--ci.nix68
1 files changed, 0 insertions, 68 deletions
diff --git a/ci.nix b/ci.nix
deleted file mode 100644
index 4fa1017..0000000
--- a/ci.nix
+++ /dev/null
@@ -1,68 +0,0 @@
-# This file provides all the buildable and cacheable packages and
-# package outputs in your 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:
- let
- licenseFromMeta = p.meta.license or [ ];
- licenseList = if builtins.isList licenseFromMeta then licenseFromMeta else [ licenseFromMeta ];
- in
- !(p.meta.broken or false) && builtins.all (license: license.free or true) licenseList;
- 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;
-}