refactor: simplify 'user' options

This commit is contained in:
2026-04-21 13:59:03 +02:00
parent 38818e7508
commit 6a30a431f8
24 changed files with 94 additions and 139 deletions

View File

@@ -7,25 +7,22 @@
let
cfg = config.hcloud;
inherit (config.host) username;
inherit (config.secrets) sopsDir;
in
{
options.hcloud = {
enable = lib.mkEnableOption "hcloud CLI configuration";
username = lib.mkOption {
type = lib.types.str;
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;
owner = config.users.users.${username}.name;
};
sops.templates."hcloud/cli.toml" = {
owner = config.users.users.${cfg.username}.name;
path = "/home/${cfg.username}/.config/hcloud/cli.toml";
owner = config.users.users.${username}.name;
path = "/home/${username}/.config/hcloud/cli.toml";
content = ''
active_context = "server"