fix(deploy): set up (magic) auto rollbacks on 'hecuba' using 'deploy-rs'

This commit is contained in:
2026-07-02 00:58:11 +02:00
parent c19d6b3152
commit cf3095556d
5 changed files with 143 additions and 95 deletions
+8 -1
View File
@@ -6,7 +6,14 @@
let let
inherit (inputs.nixpkgs) lib; inherit (inputs.nixpkgs) lib;
utils = import ../utils { inherit lib; }; utils = import ../utils { inherit lib; };
hostnames = utils.dirNames ../hosts; # exclude hosts that need auto rollback (until `colmena` supports it) for
# now, we use `deploy-rs` (which has magic rollback) for those (also see ./deploy-rs.nix)
#
# see <https://github.com/nix-community/colmena/issues/38>
# <https://github.com/nix-community/colmena/issues/344>
hostnames = lib.filter (
hostname: !((utils.hostMeta ../hosts/${hostname}).deploy.autoRollback or false)
) (utils.dirNames ../hosts);
mkNode = mkNode =
hostname: hostname:
+34
View File
@@ -0,0 +1,34 @@
{
self,
inputs,
}:
let
inherit (inputs.nixpkgs) lib;
utils = import ../utils { inherit lib; };
# only include hosts that need auto rollback (until `colmena` supports it)
# `colmena` is used for other hosts (see ./colmena.nix)
hostnames = lib.filter (
hostname: (utils.hostMeta ../hosts/${hostname}).deploy.autoRollback or false
) (utils.dirNames ../hosts);
mkNode =
hostname:
let
meta = utils.hostMeta ../hosts/${hostname};
in
{
inherit hostname;
sshUser = meta.host.username;
magicRollback = true;
autoRollback = true;
profiles.system = {
user = "root";
path = inputs.deploy-rs.lib.${meta.system}.activate.nixos self.nixosConfigurations.${hostname};
};
};
in
{
nodes = lib.genAttrs hostnames mkNode;
}
Generated
+88 -93
View File
@@ -79,11 +79,11 @@
"stable": "stable" "stable": "stable"
}, },
"locked": { "locked": {
"lastModified": 1762034856, "lastModified": 1782904768,
"narHash": "sha256-QVey3iP3UEoiFVXgypyjTvCrsIlA4ecx6Acaz5C8/PQ=", "narHash": "sha256-tu/otndlmVoSxoQVkNL5cvMFAMyekO2mCVYTl0DRlfs=",
"owner": "zhaofengli", "owner": "zhaofengli",
"repo": "colmena", "repo": "colmena",
"rev": "349b035a5027f23d88eeb3bc41085d7ee29f18ed", "rev": "1ebe1b5526099a3b108a599c59ce0e6422a1a663",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -92,25 +92,25 @@
"type": "github" "type": "github"
} }
}, },
"comin": { "deploy-rs": {
"inputs": { "inputs": {
"flake-compat": "flake-compat_2", "flake-compat": "flake-compat_2",
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
], ],
"treefmt-nix": "treefmt-nix" "utils": "utils"
}, },
"locked": { "locked": {
"lastModified": 1780200954, "lastModified": 1781627888,
"narHash": "sha256-3476T026t+XSpOvgBGzKSG6J4swuRLnPO9dR+OATtq8=", "narHash": "sha256-5yHuAh9k7rT7rtf3uRaXkiUyYvQE9oaCgzhprLm2mr8=",
"owner": "nlewo", "owner": "serokell",
"repo": "comin", "repo": "deploy-rs",
"rev": "4f14d338d755239c27131cbf6b466be4bbb20f91", "rev": "6d3087eedff75a715b40c0e124ba15d2dd7bec28",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nlewo", "owner": "serokell",
"repo": "comin", "repo": "deploy-rs",
"type": "github" "type": "github"
} }
}, },
@@ -176,11 +176,11 @@
"flake-compat": { "flake-compat": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1650374568, "lastModified": 1767039857,
"narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=", "narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=",
"owner": "edolstra", "owner": "edolstra",
"repo": "flake-compat", "repo": "flake-compat",
"rev": "b4a34015c698c7793d592d66adbab377907a2be8", "rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -192,15 +192,15 @@
"flake-compat_2": { "flake-compat_2": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1765121682, "lastModified": 1733328505,
"narHash": "sha256-4VBOP18BFeiPkyhy9o4ssBNQEvfvv1kXkasAYd0+rrA=", "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=",
"owner": "NixOS", "owner": "edolstra",
"repo": "flake-compat", "repo": "flake-compat",
"rev": "65f23138d8d09a92e30f1e5c87611b23ef451bf3", "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "edolstra",
"repo": "flake-compat", "repo": "flake-compat",
"type": "github" "type": "github"
} }
@@ -265,12 +265,15 @@
} }
}, },
"flake-utils": { "flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": { "locked": {
"lastModified": 1659877975, "lastModified": 1731533236,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -281,7 +284,7 @@
}, },
"flake-utils_2": { "flake-utils_2": {
"inputs": { "inputs": {
"systems": "systems" "systems": "systems_3"
}, },
"locked": { "locked": {
"lastModified": 1731533236, "lastModified": 1731533236,
@@ -316,17 +319,16 @@
"git-hooks": { "git-hooks": {
"inputs": { "inputs": {
"flake-compat": "flake-compat_3", "flake-compat": "flake-compat_3",
"gitignore": "gitignore",
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
] ]
}, },
"locked": { "locked": {
"lastModified": 1778507602, "lastModified": 1782908218,
"narHash": "sha256-kTwur1wV+01SdqskVMSo6JMEpg71ps3HpbFY2GsflKs=", "narHash": "sha256-wLMOrPgVyeF3XmP+qfYcLqnVdTxikdcSvbIY7rA9jTA=",
"owner": "cachix", "owner": "cachix",
"repo": "git-hooks.nix", "repo": "git-hooks.nix",
"rev": "61ab0e80d9c7ab14c256b5b453d8b3fb0189ba0a", "rev": "9f7e99119ece7705299595299f3b031f39356de1",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -335,27 +337,6 @@
"type": "github" "type": "github"
} }
}, },
"gitignore": {
"inputs": {
"nixpkgs": [
"git-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"gnome-shell": { "gnome-shell": {
"flake": false, "flake": false,
"locked": { "locked": {
@@ -396,7 +377,7 @@
"mcp-hub": { "mcp-hub": {
"inputs": { "inputs": {
"flake-parts": "flake-parts", "flake-parts": "flake-parts",
"nixpkgs": "nixpkgs_4" "nixpkgs": "nixpkgs_3"
}, },
"locked": { "locked": {
"lastModified": 1755841689, "lastModified": 1755841689,
@@ -420,11 +401,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1729742964, "lastModified": 1737420293,
"narHash": "sha256-B4mzTcQ0FZHdpeWcpDYPERtyjJd/NIuaQ9+BV1h+MpA=", "narHash": "sha256-F1G5ifvqTpJq7fdkT34e/Jy9VCyzd5XfJ9TO8fHhJWE=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nix-github-actions", "repo": "nix-github-actions",
"rev": "e04df33f62cdcf93d73e9a04142464753a16db67", "rev": "f4158fa080ef4503c8f4c820967d946c2af31ec9",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -489,7 +470,7 @@
}, },
"nixos-hardware": { "nixos-hardware": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs_2" "nixpkgs": "nixpkgs"
}, },
"locked": { "locked": {
"lastModified": 1780065812, "lastModified": 1780065812,
@@ -507,22 +488,6 @@
} }
}, },
"nixpkgs": { "nixpkgs": {
"locked": {
"lastModified": 1770107345,
"narHash": "sha256-tbS0Ebx2PiA1FRW8mt8oejR0qMXmziJmPaU1d4kYY9g=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "4533d9293756b63904b7238acb84ac8fe4c8c2c4",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1767892417, "lastModified": 1767892417,
"narHash": "sha256-8bW3q88CEg2u4hSP66Vf4lpbLonHz7hqDNBMcCY7E9U=", "narHash": "sha256-8bW3q88CEg2u4hSP66Vf4lpbLonHz7hqDNBMcCY7E9U=",
@@ -535,13 +500,13 @@
"url": "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz" "url": "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz"
} }
}, },
"nixpkgs_3": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1779560665, "lastModified": 1782723713,
"narHash": "sha256-tpyBcxPpcQb8ukyNF7DoCwfSY3VPsxHoYwj00Cayv5o=", "narHash": "sha256-oPXCU/SSUokcGaJREHibG1CBX3+s/W7orDWQOZDsEeQ=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "64c08a7ca051951c8eae34e3e3cb1e202fe36786", "rev": "b5aa0fbd538984f6e3d201be0005b4463d8b09f8",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -551,13 +516,13 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_4": { "nixpkgs_3": {
"locked": { "locked": {
"lastModified": 1743689281, "lastModified": 1779560665,
"narHash": "sha256-y7Hg5lwWhEOgflEHRfzSH96BOt26LaYfrYWzZ+VoVdg=", "narHash": "sha256-tpyBcxPpcQb8ukyNF7DoCwfSY3VPsxHoYwj00Cayv5o=",
"owner": "NixOS", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "2bfc080955153be0be56724be6fa5477b4eefabb", "rev": "64c08a7ca051951c8eae34e3e3cb1e202fe36786",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -715,7 +680,7 @@
"root": { "root": {
"inputs": { "inputs": {
"colmena": "colmena", "colmena": "colmena",
"comin": "comin", "deploy-rs": "deploy-rs",
"disko": "disko", "disko": "disko",
"firefox-addons": "firefox-addons", "firefox-addons": "firefox-addons",
"git-hooks": "git-hooks", "git-hooks": "git-hooks",
@@ -723,7 +688,7 @@
"nix-secrets": "nix-secrets", "nix-secrets": "nix-secrets",
"nixgl": "nixgl", "nixgl": "nixgl",
"nixos-hardware": "nixos-hardware", "nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs_3", "nixpkgs": "nixpkgs_2",
"nvim": "nvim", "nvim": "nvim",
"sops-nix": "sops-nix", "sops-nix": "sops-nix",
"stylix": "stylix" "stylix": "stylix"
@@ -751,16 +716,16 @@
}, },
"stable": { "stable": {
"locked": { "locked": {
"lastModified": 1750133334, "lastModified": 1782851755,
"narHash": "sha256-urV51uWH7fVnhIvsZIELIYalMYsyr2FCalvlRTzqWRw=", "narHash": "sha256-91ODtG9bUk4AMsgPfGlHzHxh+3r64DClTRxaiTHevIQ=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "36ab78dab7da2e4e27911007033713bab534187b", "rev": "f3fb8f32d52b627190abb82438bdcc75a9c77b4e",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "nixos-25.05", "ref": "release-26.05",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
@@ -778,7 +743,7 @@
"nixpkgs" "nixpkgs"
], ],
"nur": "nur", "nur": "nur",
"systems": "systems_2", "systems": "systems_4",
"tinted-kitty": "tinted-kitty", "tinted-kitty": "tinted-kitty",
"tinted-schemes": "tinted-schemes", "tinted-schemes": "tinted-schemes",
"tinted-tmux": "tinted-tmux", "tinted-tmux": "tinted-tmux",
@@ -828,6 +793,36 @@
"type": "github" "type": "github"
} }
}, },
"systems_3": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_4": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"tinted-kitty": { "tinted-kitty": {
"flake": false, "flake": false,
"locked": { "locked": {
@@ -892,21 +887,21 @@
"type": "github" "type": "github"
} }
}, },
"treefmt-nix": { "utils": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs" "systems": "systems_2"
}, },
"locked": { "locked": {
"lastModified": 1770228511, "lastModified": 1731533236,
"narHash": "sha256-wQ6NJSuFqAEmIg2VMnLdCnUc0b7vslUohqqGGD+Fyxk=", "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide", "owner": "numtide",
"repo": "treefmt-nix", "repo": "flake-utils",
"rev": "337a4fe074be1042a35086f15481d763b8ddc0e7", "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "numtide", "owner": "numtide",
"repo": "treefmt-nix", "repo": "flake-utils",
"type": "github" "type": "github"
} }
} }
+12 -1
View File
@@ -22,6 +22,10 @@
url = "github:zhaofengli/colmena"; url = "github:zhaofengli/colmena";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
deploy-rs = {
url = "github:serokell/deploy-rs";
inputs.nixpkgs.follows = "nixpkgs";
};
comin = { comin = {
url = "github:nlewo/comin"; url = "github:nlewo/comin";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
@@ -164,7 +168,14 @@
; ;
}; };
checks.${system} = gitHooks.checks; deploy = import ./deploy/deploy-rs.nix {
inherit
self
inputs
;
};
checks.${system} = gitHooks.checks // inputs.deploy-rs.lib.${system}.deployChecks self.deploy;
formatter.${system} = gitHooks.formatter; formatter.${system} = gitHooks.formatter;
devShells.${system} = gitHooks.devShells; devShells.${system} = gitHooks.devShells;
+1
View File
@@ -2,6 +2,7 @@
system = "x86_64-linux"; system = "x86_64-linux";
role = "server"; role = "server";
tags = [ "lab" ]; tags = [ "lab" ];
deploy.autoRollback = true;
host = { host = {
username = "username"; username = "username";
}; };