Added deployment definitions.
This commit is contained in:
@@ -8,24 +8,28 @@ with inputs.nixpkgs.lib; let
|
||||
};
|
||||
};
|
||||
|
||||
host-configs = genAttrs deployment-hosts
|
||||
(hostname: fudo-nixos.nixopsHostConfigurations.${hostname});
|
||||
host-config = hostname: inputs.fudo-nixos.nixopsHostConfigurations.${hostname};
|
||||
|
||||
host-uber-secrets = genAttrs deployment-hosts
|
||||
(hostname: { config, ... }: let
|
||||
uber-secrets = config.fudo.secrets.files.host-filesystem-keys;
|
||||
in {
|
||||
imports = [
|
||||
inputs.fudo-secrets.nixosModule
|
||||
({ config, ... }: {
|
||||
deployment.keys = mkIf (hasAttr hostname uber-secrets) {
|
||||
deployment.keys = mapAttrs (secret: secret-file: {
|
||||
keyFile = secret-file;
|
||||
user = "root";
|
||||
permissions = "0400";
|
||||
}) uber-secrets.${hostname};
|
||||
};
|
||||
})
|
||||
];
|
||||
});
|
||||
in network-config // host-configs // host-uber-secrets
|
||||
host-ip = hostname: domain: let
|
||||
zone-hosts = inputs.fudo-entities.entities.zones.${domain}.hosts;
|
||||
in zone-hosts.${hostname}.ipv4-address;
|
||||
|
||||
host-uber-secrets = hostname: { config, ... }: let
|
||||
uber-secrets = config.fudo.secrets.files.host-filesystem-keys;
|
||||
in {
|
||||
config.deployment.keys = mkIf (hasAttr hostname uber-secrets)
|
||||
(mapAttrs (secret: secret-file: {
|
||||
keyFile = secret-file;
|
||||
user = "root";
|
||||
permissions = "0400";
|
||||
}) uber-secrets.${hostname});
|
||||
};
|
||||
|
||||
in network-config // (mapAttrs (hostname: hostOpts: {
|
||||
imports = [
|
||||
(host-config hostname)
|
||||
(host-uber-secrets hostname)
|
||||
];
|
||||
|
||||
deployment.targetHost = host-ip hostname hostOpts.domain;
|
||||
}) deployment-hosts)
|
||||
|
||||
Reference in New Issue
Block a user