Modules: add deploy-rs config

This commit is contained in:
blahai 2025-02-19 00:48:06 +02:00
parent a87fd91f99
commit 221159aaeb
Signed by: blahai
SSH key fingerprint: SHA256:ZfCryi+V64yG+vC1ZIIsqgvBCmA31tTi7RJ6M8CvpRc
2 changed files with 44 additions and 0 deletions

View file

@ -3,6 +3,7 @@
../../systems
./args.nix
./deploy-rs.nix
./fmt.nix
./shell.nix
];

View file

@ -0,0 +1,43 @@
{
lib,
self,
inputs,
config,
...
}: let
inherit (builtins) elem mapAttrs attrNames;
inherit (lib.attrsets) filterAttrs;
# extract the names of the systems that we want to deploy
deployableSystems = attrNames (filterAttrs (_: attrs: attrs.deployable) config.easy-hosts.hosts);
easyHostsFromDeployableSystems =
filterAttrs (
name: _: elem name deployableSystems
)
self.nixosConfigurations;
in {
flake = {
checks = {
x86_64-linux = inputs.deploy-rs.lib.x86_64-linux.deployChecks self.deploy;
# aarch64-linux = inputs.deploy-rs.lib.aarch64-linux.deployChecks self.deploy;
};
deploy = {
autoRollback = true;
magicRollback = true;
# then create a list of nodes that we want to deploy that we can pass to the deploy configuration
nodes =
mapAttrs (name: node: {
hostname = name;
profiles.system = {
user = "root";
sshUser = node.config.olympus.system.mainUser or "root";
path = inputs.deploy-rs.lib.${config.easy-hosts.hosts.${name}.system}.activate.nixos node;
};
})
easyHostsFromDeployableSystems;
};
};
}