aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/build.sh
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-10-28 13:52:23 +0100
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-10-28 13:52:23 +0100
commitf3598f99127c0bdb81e7ac7676df505d72a61a2a (patch)
tree18c7fe6cc8a556d498419ff2dc4bf6e1a43d016b /scripts/build.sh
parenttests/default: Also provide `lib` to the tests (diff)
downloadnixos-server-f3598f99127c0bdb81e7ac7676df505d72a61a2a.zip
scripts/build.sh: Add gc roots to every build output
Diffstat (limited to '')
-rwxr-xr-xscripts/build.sh10
1 files changed, 9 insertions, 1 deletions
diff --git a/scripts/build.sh b/scripts/build.sh
index f1ff620..1cde3f0 100755
--- a/scripts/build.sh
+++ b/scripts/build.sh
@@ -2,6 +2,7 @@
set -eu
+root="$(git rev-parse --show-toplevel)"
wrong_arg=false
use_dirty=true
@@ -37,7 +38,14 @@ if [ "$use_dirty" = "false" ]; then
fi
for host in "server2" "server3"; do
- nix build ".#nixosConfigurations.$host.config.system.build.toplevel" --print-out-paths --no-link --option max-jobs 1
+ nix build ".#nixosConfigurations.$host.config.system.build.toplevel" --print-out-paths --option max-jobs 1
+
+ result_file="$root/result-$host"
+ if [ -L "$result_file" ]; then
+ rm "$result_file"
+ fi
+ nix-store --add-root "$result_file" --realise "$(readlink -f ./result)"
+ rm ./result
done
# vim: ft=sh