From c2df933174e0b352f47f3aac1d711ed2813157b3 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Tue, 14 May 2024 23:22:09 +0200 Subject: [PATCH] ci: set pipefail Don't add inputs to gc roots --- .forgejo/workflows/check.yml | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/.forgejo/workflows/check.yml b/.forgejo/workflows/check.yml index 5d03cdc..fc6ec37 100644 --- a/.forgejo/workflows/check.yml +++ b/.forgejo/workflows/check.yml @@ -52,6 +52,7 @@ jobs: - name: Run flake checks run: | + set -exuo pipefail # Prevent cache garbage collection by creating GC roots for target in $(nix flake show --json --all-systems | jq ' .["nixosConfigurations"] | @@ -60,16 +61,7 @@ jobs: ' | tr -d '"' ); do nix --print-build-logs --verbose --accept-flake-config --access-tokens '' \ - build --out-link ./result-$target ".#nixosConfigurations.${target}.config.system.build.toplevel" + build --out-link ./result-"$target" ".#nixosConfigurations.${target}.config.system.build.toplevel" done nix --print-build-logs --verbose --accept-flake-config --access-tokens '' flake check - - # Add GC roots for flake inputs, too - # https://github.com/NixOS/nix/issues/4250#issuecomment-1146878407 - mkdir --parents "$NIX_USER_PROFILE_DIR" - gc_root_prefix="$NIX_USER_PROFILE_DIR"/infra-flake- - echo "Adding gcroots flake inputs with prefix $gc_root_prefix ..." - nix flake archive --json 2>/dev/null | jq --raw-output '.inputs | to_entries[] | "ln --force --symbolic --no-target-directory "+.value.path+" \"'"$gc_root_prefix"'"+.key+"\""' | while read -r line; do - eval "$line" - done