about summary refs log tree commit diff stats
path: root/build.sh
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-10-24 14:49:30 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-10-24 14:49:30 +0200
commit63dc39408bdc34083b282048c2d2c1dea69af270 (patch)
tree6eb732e392f628414445a4f01f30633d28780027 /build.sh
parentfeat(modules/legacy/impermanence): Merge with the system config (diff)
downloadnixos-config-63dc39408bdc34083b282048c2d2c1dea69af270.tar.gz
nixos-config-63dc39408bdc34083b282048c2d2c1dea69af270.zip
build(build.sh): Fail, when the build fails
Diffstat (limited to 'build.sh')
-rwxr-xr-xbuild.sh16
1 files changed, 15 insertions, 1 deletions
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"