Stamp deployed revision and verify after switch

Set system.configurationRevision from flake rev and have fleet switch verify it matches the deployed git SHA.
This commit is contained in:
joshp123 2026-02-15 15:31:39 -08:00
parent e549dca9fd
commit e126e33d54
2 changed files with 10 additions and 1 deletions

View File

@ -13,6 +13,11 @@
systems = [ "x86_64-linux" "aarch64-linux" ];
forAllSystems = f: lib.genAttrs systems (system: f system);
clawbotOverlay = nix-openclaw.overlays.default;
revisionModule = { ... }: {
system.configurationRevision =
if self ? rev then self.rev else (self.dirtyRev or null);
};
in
{
nixosModules.clawdinator = import ./nix/modules/clawdinator.nix;
@ -45,6 +50,7 @@
system = "x86_64-linux";
modules = [
({ ... }: { nixpkgs.overlays = [ self.overlays.default ]; })
revisionModule
agenix.nixosModules.default
nix-openclaw.nixosModules.openclaw-gateway
./nix/hosts/clawdinator-1.nix
@ -55,6 +61,7 @@
system = "x86_64-linux";
modules = [
({ ... }: { nixpkgs.overlays = [ self.overlays.default ]; })
revisionModule
agenix.nixosModules.default
nix-openclaw.nixosModules.openclaw-gateway
./nix/hosts/clawdinator-2.nix
@ -65,6 +72,7 @@
system = "x86_64-linux";
modules = [
({ ... }: { nixpkgs.overlays = [ self.overlays.default ]; })
revisionModule
agenix.nixosModules.default
nix-openclaw.nixosModules.openclaw-gateway
./nix/hosts/clawdinator-babelfish.nix
@ -75,6 +83,7 @@
system = "x86_64-linux";
modules = [
({ ... }: { nixpkgs.overlays = [ self.overlays.default ]; })
revisionModule
agenix.nixosModules.default
nix-openclaw.nixosModules.openclaw-gateway
./nix/hosts/clawdinator-1-image.nix

View File

@ -24,6 +24,6 @@ for host in "${hosts[@]}"; do
# Run everything under bash -lc so PATH + profiles behave similarly to an interactive session.
# We also force flakes enabled for safety.
bash scripts/aws-ssm-run.sh "${instance_id}" \
"bash -lc 'set -euo pipefail; export NIX_CONFIG=\"experimental-features = nix-command flakes\"; nixos-rebuild switch --accept-flake-config --flake github:openclaw/clawdinators/${rev}#${host}; systemctl is-active clawdinator'"
"bash -lc 'set -euo pipefail; export NIX_CONFIG=\"experimental-features = nix-command flakes\"; nixos-rebuild switch --accept-flake-config --flake github:openclaw/clawdinators/${rev}#${host}; systemctl is-active clawdinator; test \"$(cat /run/current-system/configurationRevision || true)\" = \"${rev}\"'"
done