deploy-rs + nixos-anywhere

This commit is contained in:
Squibid 2025-11-25 10:42:04 -05:00
parent 469f4dcd43
commit d28ec06ae9
Signed by: squibid
GPG key ID: BECE5684D3C4005D
8 changed files with 182 additions and 24 deletions

View file

@ -12,6 +12,12 @@
declarative-jellyfin.url = "github:Sveske-Juice/declarative-jellyfin";
declarative-jellyfin.inputs.nixpkgs.follows = "nixpkgs";
deploy-rs.url = "github:serokell/deploy-rs";
deploy-rs.inputs.nixpkgs.follows = "nixpkgs";
disko.url = "github:nix-community/disko";
disko.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, unstable, ... }@inputs: let
base = [
@ -34,6 +40,8 @@
# use comma just in case I need to do some sysadmin stuff
inputs.nid.nixosModules.nix-index
{ programs.nix-index-database.comma.enable = true; }
# disko for completly declarative machines
inputs.disko.nixosModules.disko
];
# ts so DRY it makes me wanna cry
@ -47,11 +55,30 @@
] ++ modules;
}
)) <| hosts;
mkNodes = nodes:
(builtins.mapAttrs (name: options:
nixpkgs.lib.attrsets.recursiveUpdate {
hostname = name;
profiles.system = {
user = "root";
sshUser = "crown";
path = inputs.deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.${name};
};
} options
)) <| nodes;
in {
# define all of my machines
nixosConfigurations = mkHosts {
blobercraft = [];
crayon = [];
};
# and where they get deployed to
deploy.nodes = mkNodes {
crayon = { hostname = "squi.bid"; };
};
checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) inputs.deploy-rs.lib;
};
}