diff --git a/services/nix-cache/build-flakes.nix b/services/nix-cache/build-flakes.nix index 808749d..38c028b 100644 --- a/services/nix-cache/build-flakes.nix +++ b/services/nix-cache/build-flakes.nix @@ -8,21 +8,7 @@ let nixos-rebuild jq ]; - text = '' - cd /root/nixos-servers - git pull - echo "Starting nixos-servers builds" - for host in $(nix flake show --json| jq -r '.nixosConfigurations | keys[]'); do - echo "Building $host" - nixos-rebuild --verbose -L --flake ".#$host" build - done - echo "All nixos-servers builds complete" - - echo "Building gunter" - cd /root/nixos - git pull - nixos-rebuild --verbose -L --flake ".#gunter" build - ''; + text = builtins.readFile ./build-flakes.sh; }; in { diff --git a/services/nix-cache/build-flakes.sh b/services/nix-cache/build-flakes.sh new file mode 100644 index 0000000..d3de19f --- /dev/null +++ b/services/nix-cache/build-flakes.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash + +JOB_NAME="build_flakes" + +cd /root/nixos-servers +git pull +echo "Starting nixos-servers builds" +for host in $(nix flake show --json| jq -r '.nixosConfigurations | keys[]'); do + echo "Building $host" + nixos-rebuild --verbose -L --flake ".#$host" build + if [ $? -ne 0 ]; then + echo "Build failed for $host" + cat <