rix101/modules/flake/deploy.nix
reo101 91f0deb3bc
feat(flake)!: *dogfood* on all flake modules
Export all `./nix/` flake modules
Modularize `configurations` on `machines` dir
Also move `toposort` images to a single attrset binding
2024-07-25 01:25:21 +03:00

45 lines
1.3 KiB
Nix

{ lib, config, self, inputs, ... }:
let
inherit (import ../../nix/utils.nix { inherit lib self; })
accumulateMachines
configuration-type-to-deploy-type;
in
{
flake = {
deploy.nodes =
accumulateMachines
# TODO: nix-on-droid
["nixos" "nix-darwin"]
({ host, system, configuration-type, configuration }:
let
deploy-config-path =
"${config.flake.autoConfigurations.${configuration-type}.dir}/${system}/${host}/deploy.nix";
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
deploy-type = configuration-type-to-deploy-type configuration-type;
in
inputs.deploy-rs.lib.${system}.activate.${deploy-type} configuration;
};
};
}
);
checks =
lib.mapAttrs
(system: deployLib:
deployLib.deployChecks
self.deploy)
inputs.deploy-rs.lib;
};
}