59 lines
1.2 KiB
Nix
59 lines
1.2 KiB
Nix
{ inputs, ... }:
|
|
let
|
|
inherit (inputs)
|
|
self
|
|
deploy-rs
|
|
nixpkgs
|
|
nixos-anywhere
|
|
;
|
|
|
|
inherit (nixpkgs) lib;
|
|
|
|
genNode =
|
|
hostName: nixosCfg:
|
|
let
|
|
deploy = nixosCfg.config.deploy;
|
|
system = nixosCfg.pkgs.system;
|
|
in
|
|
{
|
|
hostname = deploy.address;
|
|
profiles.system.path = deploy-rs.lib.${system}.activate.nixos nixosCfg;
|
|
};
|
|
|
|
# Filter out nodes where deploy.enable != true
|
|
deployableNodes = lib.filterAttrs (hostName: nixosCfg: nixosCfg.config.deploy.enable or false) (
|
|
self.nixosConfigurations or { }
|
|
);
|
|
|
|
in
|
|
{
|
|
perSystem =
|
|
{
|
|
system,
|
|
...
|
|
}:
|
|
{
|
|
apps = rec {
|
|
default = deploy;
|
|
# secrets = {
|
|
# type = "app";
|
|
# program = "${agenix.packages.${system}.agenix}/bin/agenix";
|
|
# meta.description = "";
|
|
# };
|
|
install = {
|
|
type = "app";
|
|
program = "${nixos-anywhere.packages.${system}.nixos-anywhere}/bin/nixos-anywhere";
|
|
meta.description = "";
|
|
};
|
|
deploy = deploy-rs.apps.${system}.deploy-rs;
|
|
};
|
|
};
|
|
|
|
flake.deploy = {
|
|
autoRollback = false;
|
|
magicRollback = true;
|
|
user = "root";
|
|
# remoteBuild = true;
|
|
nodes = lib.mapAttrs genNode deployableNodes;
|
|
};
|
|
}
|