Generate proper service configs and fix password credential loading

This commit is contained in:
clerie 2025-01-11 15:35:41 +01:00
parent b0c07f9514
commit 9f1aa15509

View File

@ -50,13 +50,12 @@ in {
after = [ "network.target" ]; after = [ "network.target" ];
serviceConfig = { serviceConfig = {
type = "simple"; Type = "simple";
User = "scan-to-gpg"; User = "scan-to-gpg";
Group = "scan-to-gpg"; Group = "scan-to-gpg";
StateDirectory = "scan-to-gpg"; StateDirectory = "scan-to-gpg";
StateDirectoryMode = "775"; StateDirectoryMode = "775";
} // mkIf (cfg.passFile != null) { LoadCredential = mkIf (cfg.passFile != null) "pass-file:${cfg.passFile}";
LoadCredential = "pass-file:${cfg.passFile}";
}; };
environment = mkIf (cfg.passFile != null) { environment = mkIf (cfg.passFile != null) {
@ -69,7 +68,7 @@ in {
}${ }${
optionalString (cfg.user != null) "-user ${cfg.user} " optionalString (cfg.user != null) "-user ${cfg.user} "
}${ }${
optionalString (cfg.passFile != null) "-pass <($${PASS_FILE}) " optionalString (cfg.passFile != null) "-pass \"\$(cat \"\${PASS_FILE}\")\" "
}-output ${cfg.output} -gpgkey ${cfg.gpgkey} }-output ${cfg.output} -gpgkey ${cfg.gpgkey}
''; '';