commit 6b79f7d6ea0a25b4693fd0ba3df868350f3b91a7
parent 5cbf8abd0a84a535c9d2fff0e2fe4afdb8261274
Author: Vincent Demeester <vincent@sbr.pm>
Date: Mon, 25 May 2020 14:16:00 +0200
builds: split nixos into pkgs and systems
- pkgs builds my packages (against nixos, nixos-unstable and nixpkgs)
and cache them on cachix (shortbrain)
- systems builds the systems (making sure an update will work "live")
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Diffstat:
4 files changed, 70 insertions(+), 30 deletions(-)
diff --git a/.builds/nix-pkgs.yml b/.builds/nix-pkgs.yml
@@ -0,0 +1,26 @@
+image: nixos/20.03
+secrets:
+ - 67527e1f-d69c-4f8e-a26d-21685f4ed380
+ - 0818d60d-b587-4d4e-81d8-dc15072ccb97
+sources:
+ - git@git.sr.ht:~vdemeester/secrets
+tasks:
+- setup: |
+ set -euo pipefail
+ set +x
+ export CACHIX_SIGNING_KEY=$(cat ~/.cachix.key)
+ set -x
+ nix-env -iA cachix -f https://cachix.org/api/v1/install
+ cachix use shortbrain
+- nixos: |
+ nix-build home/ci.nix -A nixosCacheOutputs | cachix push shortbrain
+- nixos-unstable: |
+ nix-build home/ci.nix -A nixosUnstableCacheOutputs | cachix push shortbrain
+- nixpkgs: |
+ nix-build home/ci.nix -A nixkgsCacheOutputs | cachix push shortbrain
+- nur-update: |
+ curl -XPOST "https://nur-update.herokuapp.com/update?repo=vdemeester"
+triggers:
+- action: email
+ condition: failure
+ to: vincent@sbr.pm
diff --git a/.builds/nix-systems.yml b/.builds/nix-systems.yml
@@ -0,0 +1,20 @@
+image: nixos/20.03
+secrets:
+ - 67527e1f-d69c-4f8e-a26d-21685f4ed380
+ - 0818d60d-b587-4d4e-81d8-dc15072ccb97
+sources:
+ - git@git.sr.ht:~vdemeester/secrets
+tasks:
+- setup: |
+ set -euo pipefail
+ set +x
+ export CACHIX_SIGNING_KEY=$(cat ~/.cachix.key)
+ set -x
+ nix-env -iA cachix -f https://cachix.org/api/v1/install
+ cachix use shortbrain
+- systems: |
+ nix-build -A x86_64-linux
+triggers:
+- action: email
+ condition: failure
+ to: vincent@sbr.pm
diff --git a/.builds/nixos.yml b/.builds/nixos.yml
@@ -1,21 +0,0 @@
-image: nixos/20.03
-secrets:
- - 67527e1f-d69c-4f8e-a26d-21685f4ed380
- - 0818d60d-b587-4d4e-81d8-dc15072ccb97
-sources:
- - git@git.sr.ht:~vdemeester/secrets
-tasks:
-- setup: |
- set -euo pipefail
- set +x
- export CACHIX_SIGNING_KEY=$(cat ~/.cachix.key)
- set -x
- nix-env -iA cachix -f https://cachix.org/api/v1/install
- cachix use shortbrain
-- pkgs: |
- nix-build home/ci.nix -A cacheOutputs | cachix push shortbrain
- curl -XPOST "https://nur-update.herokuapp.com/update?repo=vdemeester"
-triggers:
-- action: email
- condition: failure
- to: vincent@sbr.pm
diff --git a/ci.nix b/ci.nix
@@ -9,7 +9,11 @@
# then your CI will be able to build and cache only those packages for
# which this is possible.
-{ pkgs ? import <nixpkgs> { } }:
+{ sources ? import ./nix
+, pkgs ? sources.pkgs { }
+, pkgs-unstable ? sources.pkgs-unstable { }
+, nixpkgs ? sources.nixpkgs { }
+}:
with builtins;
let
@@ -29,24 +33,35 @@ let
in
concatMap f (attrValues s);
outputsOf = p: map (o: p.${o}) p.outputs;
- nurAttrs = import ./pkgs/default.nix { inherit pkgs; };
- nurPkgs =
+ nurAttrs = p: import ./pkgs/default.nix { pkgs = p; };
+ nurPkgs = p:
flattenPkgs (
listToAttrs (
map
- (n: nameValuePair n nurAttrs.${n})
+ (n: nameValuePair n (nurAttrs p).${n})
(
filter
(n: !isReserved n)
- (attrNames nurAttrs)
+ (attrNames (nurAttrs p))
)
)
);
+ nixosNurPkgs = nurPkgs pkgs;
+ nixosUnstableNurPkgs = nurPkgs pkgs-unstable;
+ nixpkgsNurPkgs = nurPkgs nixpkgs;
in
rec {
- buildPkgs = filter isBuildable nurPkgs;
- cachePkgs = filter isCacheable buildPkgs;
+ nixosBuildPkgs = filter isBuildable nixosNurPkgs;
+ nixosCachePkgs = filter isCacheable nixosBuildPkgs;
+ nixosUnstableBuildPkgs = filter isBuildable nixosUnstableNurPkgs;
+ nixosUnstableCachePkgs = filter isCacheable nixosUnstableBuildPkgs;
+ nixpkgsBuildPkgs = filter isBuildable nixpkgsNurPkgs;
+ nixpkgsCachePkgs = filter isCacheable nixpkgsBuildPkgs;
- buildOutputs = concatMap outputsOf buildPkgs;
- cacheOutputs = concatMap outputsOf cachePkgs;
+ nixosBuildOutputs = concatMap outputsOf nixosBuildPkgs;
+ nixosCacheOutputs = concatMap outputsOf nixosCachePkgs;
+ nixosUnstableBuildOutputs = concatMap outputsOf nixosUnstableBuildPkgs;
+ nixosUnstableCacheOutputs = concatMap outputsOf nixosUnstableCachePkgs;
+ nixpkgsBuildOutputs = concatMap outputsOf nixpkgsBuildPkgs;
+ nixpkgsCacheOutputs = concatMap outputsOf nixpkgsCachePkgs;
}