refactor: simplify 'user' options
This commit is contained in:
@@ -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"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user