From 9f1aa15509c9b0284774be95ef020f612c385353 Mon Sep 17 00:00:00 2001
From: clerie <git@clerie.de>
Date: Sat, 11 Jan 2025 15:35:41 +0100
Subject: [PATCH] Generate proper service configs and fix password credential
 loading

---
 module.nix | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/module.nix b/module.nix
index 7445068..059669e 100644
--- a/module.nix
+++ b/module.nix
@@ -50,13 +50,12 @@ in {
       after = [ "network.target" ];
 
       serviceConfig = {
-        type = "simple";
+        Type = "simple";
         User = "scan-to-gpg";
         Group = "scan-to-gpg";
         StateDirectory = "scan-to-gpg";
         StateDirectoryMode = "775";
-      } // mkIf (cfg.passFile != null) {
-        LoadCredential = "pass-file:${cfg.passFile}";
+        LoadCredential = mkIf (cfg.passFile != null) "pass-file:${cfg.passFile}";
       };
 
       environment = mkIf (cfg.passFile != null) {
@@ -69,7 +68,7 @@ in {
         }${
           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}
       '';