From b95d16e8379e95c626da4650e812627ca9b71136 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Tue, 23 Apr 2024 16:32:11 +0200 Subject: [PATCH] ci: prevent flake inputs from GC as well --- .forgejo/workflows/check.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.forgejo/workflows/check.yml b/.forgejo/workflows/check.yml index f18c8bd..28cfd2a 100644 --- a/.forgejo/workflows/check.yml +++ b/.forgejo/workflows/check.yml @@ -58,4 +58,15 @@ jobs: nix --print-build-logs --verbose --accept-flake-config --access-tokens '' \ 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 + nix_profile_dir="/home/$USER"/.nix-profile + mkdir --parents "$nix_profile_dir" + gc_root_prefix="$nix_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