nixos/maddy: change secrets option to accept a list of paths

This commit is contained in:
Jonas Heinrich 2023-05-27 15:49:05 +02:00 committed by Nick Cao
parent 288b2fa580
commit 63f73b3295
No known key found for this signature in database

View file

@ -335,12 +335,13 @@ in {
}; };
secrets = lib.mkOption { secrets = lib.mkOption {
type = lib.types.path; type = with types; listOf path;
description = lib.mdDoc '' description = lib.mdDoc ''
A file containing the various secrets. Should be in the format A list of files containing the various secrets. Should be in the format
expected by systemd's `EnvironmentFile` directory. Secrets can be expected by systemd's `EnvironmentFile` directory. Secrets can be
referenced in the format `{env:VAR}`. referenced in the format `{env:VAR}`.
''; '';
default = [ ];
}; };
}; };
@ -379,7 +380,7 @@ in {
User = cfg.user; User = cfg.user;
Group = cfg.group; Group = cfg.group;
StateDirectory = [ "maddy" ]; StateDirectory = [ "maddy" ];
EnvironmentFile = lib.mkIf (cfg.secrets != null) "${cfg.secrets}"; EnvironmentFile = cfg.secrets;
}; };
restartTriggers = [ config.environment.etc."maddy/maddy.conf".source ]; restartTriggers = [ config.environment.etc."maddy/maddy.conf".source ];
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];