Skip to content

Commit

Permalink
nixos/paperless: use toShellVars for paperless-manage
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Atemu committed Jul 8, 2023
1 parent 78419ed commit 44f637a
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions nixos/modules/services/misc/paperless.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit 44f637a

Please sign in to comment.