Skip to content
Snippets Groups Projects

Fix cache miss in CI

Merged Vincent Lafeychine requested to merge nix/cache-miss into main
3 files
+ 61
69
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 10
5
@@ -4,11 +4,12 @@
stages: [ nix-cache, lint, build, tests ]
variables:
DEPENDENCIES: ".#theories.inputDerivation .#frontend.inputDerivation .#frontend.cargoArtifacts nixpkgs#gnumake nixpkgs#gnupatch nixpkgs#gnused"
NIX_STORE_ARTIFACTS_PATH: ".ci_nix_artifacts"
NIX_STORE_CACHE_PATH: ".ci_nix_cache"
default:
image: nixos/nix:2.20.1
image: nixos/nix:2.21.2
interruptible: true
tags: [ fp ]
@@ -18,16 +19,20 @@ default:
- echo "trusted-public-keys = ${NIX_CI_CACHE_PUB_KEY} cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" >> /etc/nix/nix.conf
# Since the cache is not guaranteed to be available, it is preferable to build the dependencies for each job (which is no-op if the cache is available)
- nix build --print-build-logs .#theories.inputDerivation
- nix build --print-build-logs .#frontend.inputDerivation
- nix build --print-build-logs ${DEPENDENCIES}
cache:
cache: &nix_cache
key:
files: [ flake.lock, flake.nix ]
paths: [ "${NIX_STORE_CACHE_PATH}" ]
policy: pull
.build_to_cache:
cache:
<<: *nix_cache
policy: pull-push
script:
- nix build --print-build-logs ${NIX_DERIVATION}
- nix store sign --key-file <(echo "${NIX_CI_CACHE_PRIV_KEY}") --recursive ${NIX_DERIVATION}
@@ -54,7 +59,7 @@ default:
nix-cache:
stage: nix-cache
variables:
NIX_DERIVATION: .#theories.inputDerivation .#frontend.inputDerivation nixpkgs#gnumake nixpkgs#gnupatch
NIX_DERIVATION: ${DEPENDENCIES}
extends: .build_to_cache
clippy:
Loading