Modules: add deploy-rs config
This commit is contained in:
parent
a87fd91f99
commit
221159aaeb
2 changed files with 44 additions and 0 deletions
|
@ -3,6 +3,7 @@
|
||||||
../../systems
|
../../systems
|
||||||
|
|
||||||
./args.nix
|
./args.nix
|
||||||
|
./deploy-rs.nix
|
||||||
./fmt.nix
|
./fmt.nix
|
||||||
./shell.nix
|
./shell.nix
|
||||||
];
|
];
|
||||||
|
|
43
modules/flake/deploy-rs.nix
Normal file
43
modules/flake/deploy-rs.nix
Normal 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;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue