deploy-rs instead of colmena cause its easier

This commit is contained in:
2025-10-31 17:47:45 +08:00
parent e62b3d8d67
commit eba44eb72e
3 changed files with 133 additions and 17 deletions

80
flake.lock generated
View File

@@ -43,6 +43,28 @@
"type": "github" "type": "github"
} }
}, },
"deploy-rs": {
"inputs": {
"flake-compat": "flake-compat",
"nixpkgs": [
"nixpkgs"
],
"utils": "utils"
},
"locked": {
"lastModified": 1756719547,
"narHash": "sha256-N9gBKUmjwRKPxAafXEk1EGadfk2qDZPBQp4vXWPHINQ=",
"owner": "serokell",
"repo": "deploy-rs",
"rev": "125ae9e3ecf62fb2c0fd4f2d894eb971f1ecaed2",
"type": "github"
},
"original": {
"owner": "serokell",
"repo": "deploy-rs",
"type": "github"
}
},
"disko": { "disko": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@@ -64,6 +86,22 @@
} }
}, },
"flake-compat": { "flake-compat": {
"flake": false,
"locked": {
"lastModified": 1733328505,
"narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_2": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1650374568, "lastModified": 1650374568,
@@ -102,7 +140,7 @@
}, },
"flake-utils": { "flake-utils": {
"inputs": { "inputs": {
"systems": "systems_2" "systems": "systems_3"
}, },
"locked": { "locked": {
"lastModified": 1731533236, "lastModified": 1731533236,
@@ -139,7 +177,7 @@
}, },
"flake-utils_2": { "flake-utils_2": {
"inputs": { "inputs": {
"systems": "systems_4" "systems": "systems_5"
}, },
"locked": { "locked": {
"lastModified": 1694529238, "lastModified": 1694529238,
@@ -263,7 +301,7 @@
"nixpkgs" "nixpkgs"
], ],
"nuschtosSearch": "nuschtosSearch", "nuschtosSearch": "nuschtosSearch",
"systems": "systems_3" "systems": "systems_4"
}, },
"locked": { "locked": {
"lastModified": 1761744315, "lastModified": 1761744315,
@@ -305,6 +343,7 @@
"root": { "root": {
"inputs": { "inputs": {
"agenix": "agenix", "agenix": "agenix",
"deploy-rs": "deploy-rs",
"disko": "disko", "disko": "disko",
"home-manager": "home-manager_2", "home-manager": "home-manager_2",
"nixpkgs": "nixpkgs_2", "nixpkgs": "nixpkgs_2",
@@ -314,7 +353,7 @@
}, },
"snowfall-lib": { "snowfall-lib": {
"inputs": { "inputs": {
"flake-compat": "flake-compat", "flake-compat": "flake-compat_2",
"flake-utils-plus": "flake-utils-plus", "flake-utils-plus": "flake-utils-plus",
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
@@ -393,6 +432,39 @@
"repo": "default", "repo": "default",
"type": "github" "type": "github"
} }
},
"systems_5": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"utils": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

View File

@@ -3,6 +3,10 @@
inputs = { inputs = {
agenix.url = "github:ryantm/agenix"; agenix.url = "github:ryantm/agenix";
deploy-rs = {
url = "github:serokell/deploy-rs";
inputs.nixpkgs.follows = "nixpkgs";
};
disko = { disko = {
url = "github:nix-community/disko"; url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
@@ -24,7 +28,9 @@
outputs = outputs =
inputs: inputs:
inputs.snowfall-lib.mkFlake { let
# Base outputs generated by snowfall-lib
flake = inputs.snowfall-lib.mkFlake {
inherit inputs; inherit inputs;
src = ./.; src = ./.;
snowfall = { snowfall = {
@@ -40,4 +46,41 @@
allowUnfree = true; allowUnfree = true;
}; };
}; };
inventory = import ./inventory.nix;
mkNode =
name:
let
node = inventory.nodes.${name};
system = flake.nixosConfigurations.${name}.pkgs.system;
activate = inputs.deploy-rs.lib.${system}.activate;
in
{
hostname = node.zerotierIp or node.hostname;
profiles.system = {
user = "root";
path = activate.nixos flake.nixosConfigurations.${name};
};
};
deployCfg = {
user = "root";
remoteBuild = true;
nodes = builtins.listToAttrs (
map (name: {
name = name;
value = mkNode name;
}) (builtins.attrNames inventory.nodes)
);
};
in
flake
// {
# deploy-rs configuration generated from inventory.nix
deploy = deployCfg;
# Helpful check to validate deploy config
checks.x86_64-linux.deploy = inputs.deploy-rs.lib.x86_64-linux.deployChecks deployCfg;
};
} }

View File

@@ -18,6 +18,7 @@
pkgs.cachix pkgs.cachix
pkgs.ouch pkgs.ouch
inputs.agenix.packages.aarch64-darwin.default # this should be using ${home} but it doesn't seem to be working inputs.agenix.packages.aarch64-darwin.default # this should be using ${home} but it doesn't seem to be working
inputs.deploy-rs.packages.aarch64-darwin.default # this should be using ${home} but it doesn't seem to be working
pkgs.claude-code pkgs.claude-code
pkgs.codex pkgs.codex