vars: remove secretsUploadDirectory from common module

This commit is contained in:
lassulus
2024-11-27 13:32:00 +01:00
parent 354a71f574
commit c00ac4a246
7 changed files with 28 additions and 22 deletions

View File

@@ -55,7 +55,7 @@ in
);
}
);
inherit (config.clan.core.vars.settings) secretUploadDirectory secretModule publicModule;
inherit (config.clan.core.vars.settings) secretModule publicModule;
};
inherit (config.clan.core.networking) targetHost buildHost;
inherit (config.clan.core.deployment) requireExplicitUpdate;

View File

@@ -39,7 +39,18 @@ let
|| (options.services ? userborn && config.services.userborn.enable);
in
{
options.clan.vars.password-store = {
secretLocation = lib.mkOption {
type = lib.types.path;
default = "/etc/secret-vars";
description = ''
location where the tarball with the password-store secrets will be uploaded to and the manifest
'';
};
};
config = {
system.clan.deployment.data.password-store.secretLocation =
config.clan.vars.password-store.secretLocation;
clan.core.vars.settings =
lib.mkIf (config.clan.core.vars.settings.secretStore == "password-store")
{
@@ -48,7 +59,6 @@ in
lib.mkIf file.config.secret {
path = "/run/secrets/${file.config.generatorName}/${file.config.name}";
};
secretUploadDirectory = lib.mkDefault "/etc/secret-vars";
secretModule = "clan_cli.vars.secret_modules.password_store";
};
system.activationScripts.setupSecrets =
@@ -66,13 +76,13 @@ in
]
''
[ -e /run/current-system ] || echo setting up secrets...
${installSecretTarball}/bin/install-secret-tarball ${config.clan.core.vars.settings.secretUploadDirectory}/secrets.tar.gz
${installSecretTarball}/bin/install-secret-tarball ${config.clan.password-store.secretTarballLocation}/secrets.tar.gz
''
// lib.optionalAttrs (config.system ? dryActivationScript) {
supportsDryActivation = true;
}
);
systemd.services.sops-install-secrets =
systemd.services.pass-install-secrets =
lib.mkIf
(
(config.clan.core.vars.settings.secretStore == "password-store")
@@ -86,7 +96,7 @@ in
serviceConfig = {
Type = "oneshot";
ExecStart = [
"${installSecretTarball}/bin/install-secret-tarball ${config.clan.core.vars.settings.secretUploadDirectory}/secrets.tar.gz"
"${installSecretTarball}/bin/install-secret-tarball ${config.clan.password-store.secretTarballLocation}/secrets.tar.gz"
];
RemainAfterExit = true;
};

View File

@@ -32,7 +32,6 @@ in
);
};
secretModule = "clan_cli.vars.secret_modules.sops";
secretUploadDirectory = lib.mkDefault "/var/lib/sops-nix";
};
config.sops = lib.mkIf (config.clan.core.vars.settings.secretStore == "sops") {

View File

@@ -22,14 +22,6 @@
'';
};
secretUploadDirectory = lib.mkOption {
type = lib.types.path;
description = ''
The directory where secrets are uploaded into, This is backend specific.
This is usally set by the secret store backend.
'';
};
# TODO: see if this is the right approach. Maybe revert to secretPathFunction
fileModule = lib.mkOption {
type = lib.types.deferredModule;