about summary refs log tree commit diff
path: root/nixos/modules/services/misc/paperless.nix
diff options
context:
space:
mode:
authorAtemu <atemu.main@gmail.com>2023-07-07 17:48:48 +0200
committerAtemu <atemu.main@gmail.com>2023-07-08 16:03:45 +0200
commit44f637aa8d933ec682b461877f12125d5857657c (patch)
tree69603a140bd3a0dbcf5e3e65b6a428b32534c2ef /nixos/modules/services/misc/paperless.nix
parent78419edadf0fabbe5618643bd850b2f2198ed060 (diff)
nixos/paperless: use toShellVars for paperless-manage
The homebrewed snippet didn't escape vars properly which is an issue because
PAPERLESS_OCR_USER_ARGS requires a JSON string. This also meant a discrepancy
between the services' env vars and paperless-manage's.

Just use the correctly functioning library function for this instead.
Diffstat (limited to 'nixos/modules/services/misc/paperless.nix')
-rw-r--r--nixos/modules/services/misc/paperless.nix13
1 files changed, 5 insertions, 8 deletions
diff --git a/nixos/modules/services/misc/paperless.nix b/nixos/modules/services/misc/paperless.nix
index 8fe628a40880f..313d18d72bd34 100644
--- a/nixos/modules/services/misc/paperless.nix
+++ b/nixos/modules/services/misc/paperless.nix
@@ -26,14 +26,11 @@ let
     lib.mapAttrs (_: toString) cfg.extraConfig
   );
 
-  manage =
-    let
-      setupEnv = lib.concatStringsSep "\n" (mapAttrsToList (name: val: "export ${name}=\"${val}\"") env);
-    in
-    pkgs.writeShellScript "manage" ''
-      ${setupEnv}
-      exec ${pkg}/bin/paperless-ngx "$@"
-    '';
+  manage = pkgs.writeShellScript "manage" ''
+    set -o allexport # Export the following env vars
+    ${lib.toShellVars env}
+    exec ${pkg}/bin/paperless-ngx "$@"
+  '';
 
   # Secure the services
   defaultServiceConfig = {