2024-07-19 00:06:58 +02:00
|
|
|
{ lib, config, self, inputs, ... }:
|
|
|
|
|
|
|
|
let
|
2024-07-29 00:35:14 +02:00
|
|
|
inherit (import ../../nix/utils.nix { inherit lib config self; })
|
2024-07-27 12:04:48 +02:00
|
|
|
accumulateHosts
|
2024-07-19 00:33:09 +02:00
|
|
|
configuration-type-to-deploy-type;
|
2024-07-19 00:06:58 +02:00
|
|
|
in
|
|
|
|
{
|
|
|
|
flake = {
|
|
|
|
deploy.nodes =
|
2024-07-27 12:04:48 +02:00
|
|
|
accumulateHosts
|
2024-07-19 00:06:58 +02:00
|
|
|
# TODO: nix-on-droid
|
|
|
|
["nixos" "nix-darwin"]
|
2024-07-19 00:33:09 +02:00
|
|
|
({ host, system, configuration-type, configuration }:
|
2024-07-19 00:06:58 +02:00
|
|
|
let
|
|
|
|
deploy-config-path =
|
2024-07-25 00:25:21 +02:00
|
|
|
"${config.flake.autoConfigurations.${configuration-type}.dir}/${system}/${host}/deploy.nix";
|
2024-07-19 00:06:58 +02:00
|
|
|
deploy-config =
|
|
|
|
import deploy-config-path;
|
|
|
|
in
|
|
|
|
lib.optionalAttrs
|
|
|
|
(builtins.pathExists deploy-config-path)
|
|
|
|
{
|
|
|
|
${host} = {
|
|
|
|
inherit (deploy-config)
|
|
|
|
hostname;
|
|
|
|
profiles.system = deploy-config // {
|
|
|
|
path =
|
|
|
|
let
|
2024-07-19 00:33:09 +02:00
|
|
|
deploy-type = configuration-type-to-deploy-type configuration-type;
|
2024-07-19 00:06:58 +02:00
|
|
|
in
|
2024-07-19 00:33:09 +02:00
|
|
|
inputs.deploy-rs.lib.${system}.activate.${deploy-type} configuration;
|
2024-07-19 00:06:58 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
checks =
|
|
|
|
lib.mapAttrs
|
|
|
|
(system: deployLib:
|
|
|
|
deployLib.deployChecks
|
|
|
|
self.deploy)
|
|
|
|
inputs.deploy-rs.lib;
|
|
|
|
};
|
|
|
|
}
|