mirror of
https://github.com/kittywitch/nixfiles.git
synced 2026-02-10 04:49:19 -08:00
ensure sources are cached locally before building
This commit is contained in:
parent
6a3b8ef8ca
commit
a8bfcdf17f
3 changed files with 28 additions and 5 deletions
10
ci/hosts.nix
10
ci/hosts.nix
|
|
@ -4,6 +4,16 @@
|
|||
ci.gh-actions.export = true;
|
||||
channels.nixfiles.path = ../.;
|
||||
|
||||
# ensure sources are fetched and available in the local store before evaluating host configs
|
||||
environment.bootstrap = {
|
||||
sourceCache = channels.cipkgs.runCommand "sources" {
|
||||
srcs = attrNames channels.nixfiles.sourceCache.local;
|
||||
} ''
|
||||
mkdir -p $out/share/sources
|
||||
ln -s $srcs $out/share/sources/
|
||||
'';
|
||||
};
|
||||
|
||||
jobs = let hostnames = [ "samhain" "yule" "athame" ];
|
||||
in mapAttrs' (k: nameValuePair "host-${k}") (genAttrs hostnames (host: {
|
||||
tasks.${host}.inputs = channels.nixfiles.hosts.${host}.config.system.build.toplevel;
|
||||
|
|
|
|||
|
|
@ -51,11 +51,14 @@ with lib; {
|
|||
done
|
||||
|
||||
if git status --porcelain | grep -qF nix/sources.json; then
|
||||
nix build --no-link -f . sourceCache.local
|
||||
if nix build -Lf . hosts.{athame,yule,samhain}.config.system.build.toplevel; then
|
||||
nix build -f ../. sourceCache
|
||||
if [[ -n $CACHIX_SIGNING_KEY ]]; then
|
||||
cachix push kittywitch $(nix eval '(toString (import ../.).sourceCache)')
|
||||
nix-build $(echo "-A hosts."{athame,yule,samhain}.config.system.build.toplevel) | cachix push kittywitch
|
||||
nix build --no-link -f . sourceCache.all
|
||||
cachix push kittywitch $(nix eval -f . sourceCache.allStr)
|
||||
|
||||
cachix push kittywitch result*/ &
|
||||
CACHIX_PUSH=$!
|
||||
fi
|
||||
if [[ -n $OPENSSH_PRIVATE_KEY ]]; then
|
||||
git add nix/sources.json
|
||||
|
|
@ -66,6 +69,8 @@ with lib; {
|
|||
GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" \
|
||||
git push gitea master
|
||||
fi
|
||||
|
||||
wait ''${CACHIX_PUSH-}
|
||||
fi
|
||||
else
|
||||
echo "no source changes" >&2
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue