Merge pull request 'vars: add restartUnits option' (#3784) from vars-userborn into main

Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/3784
This commit is contained in:
Mic92
2025-05-30 09:45:17 +00:00
5 changed files with 20 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
{
pkgs,
config,
lib,
...
}:
{
@@ -12,6 +13,7 @@
files.password-hash = {
neededFor = "users";
};
files.password-hash.restartUnits = lib.optional (config.services.userborn.enable) "userborn.service";
files.password = {
deploy = false;
};

View File

@@ -31,6 +31,7 @@ in
clan.core.vars.generators.user-password = {
files.user-password-hash.neededFor = "users";
files.user-password-hash.restartUnits = lib.optional (config.services.userborn.enable) "userborn.service";
prompts.user-password.type = "hidden";
prompts.user-password.persist = true;

View File

@@ -298,6 +298,16 @@ in
description = "The unix file mode of the file. Must be a 4-digit octal number.";
default = "0400";
};
restartUnits = lib.mkOption {
description = ''
A list of systemd units that should be restarted after the file is deployed.
This is useful for services that need to reload their configuration after the file is updated.
WARNING: currently only sops-nix implements this option.
'';
type = listOf str;
default = [ ];
};
value =
lib.mkOption {
description = ''

View File

@@ -48,6 +48,7 @@ in
group
mode
neededForUsers
restartUnits
;
sopsFile = builtins.path {
name = "${secret.generator}_${secret.name}";

View File

@@ -28,7 +28,12 @@ in
generator = gen_name;
neededForUsers = file.neededFor == "users";
inherit (generator) share;
inherit (file) owner group mode;
inherit (file)
owner
group
mode
restartUnits
;
}) (relevantFiles generator)
) generators
);