refactor(secrets): simplify secrets

This commit is contained in:
2026-04-20 19:17:37 +02:00
parent 9e3652a55e
commit fd80d9424e
9 changed files with 102 additions and 94 deletions

View File

@@ -1,30 +1,27 @@
{
lib,
config,
myUtils,
...
}:
let
cfg = config.hcloud;
inherit (config.secrets) sopsDir;
inherit (config.secrets) owner;
in
{
options.hcloud = {
enable = lib.mkEnableOption "hcloud CLI configuration";
username = lib.mkOption {
type = lib.types.str;
description = "Username for hcloud CLI configuration";
description = "username for hcloud CLI configuration";
};
};
config = lib.mkIf cfg.enable {
sops.secrets = myUtils.mkSopsSecrets sopsDir "hcloud" [ "api-token" ] {
owner = config.users.users.${cfg.username}.name;
};
secrets.groups.hcloud = [ "api-token" ];
sops.templates."hcloud/cli.toml" = {
owner = config.users.users.${cfg.username}.name;
inherit owner;
path = "/home/${cfg.username}/.config/hcloud/cli.toml";
content = ''
active_context = "server"