From 63dc39408bdc34083b282048c2d2c1dea69af270 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Thu, 24 Oct 2024 14:49:30 +0200 Subject: build(build.sh): Fail, when the build fails --- build.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'build.sh') diff --git a/build.sh b/build.sh index 357acf58..3c3d387c 100755 --- a/build.sh +++ b/build.sh @@ -18,7 +18,21 @@ check() { fi } -system="$(nix build ".#nixosConfigurations.$host.config.system.build.toplevel" --print-out-paths --no-link)" +build_system() { + _val="$(nix build ".#nixosConfigurations.$host.config.system.build.toplevel" --print-out-paths --no-link)" + exit_val="$?" + + if [ "$exit_val" -ne 0 ]; then + echo "ERROR: Failed to build you system config for host: '$host'" 1>&2 + printf 1 + else + printf "%s" "$_val" + fi +} + +system="$(build_system)" +[ "$system" = "1" ] && exit 1 + check "$SYSTEM_OUT" ln --symbolic "$system" "$SYSTEM_OUT" -- cgit 1.4.1