Merge pull request #242275 from Atemu/nixos/paperless-manage-toShellVars

nixos/paperless: use toShellVars for paperless-manage

authored by Martin Weinelt and committed by GitHub 6847465f 821c7274

+22 -12
+22 -12
nixos/modules/services/misc/paperless.nix
··· 26 lib.mapAttrs (_: toString) cfg.extraConfig 27 ); 28 29 - manage = 30 - let 31 - setupEnv = lib.concatStringsSep "\n" (mapAttrsToList (name: val: "export ${name}=\"${val}\"") env); 32 - in 33 - pkgs.writeShellScript "manage" '' 34 - ${setupEnv} 35 - exec ${pkg}/bin/paperless-ngx "$@" 36 - ''; 37 38 # Secure the services 39 defaultServiceConfig = { ··· 172 description = lib.mdDoc "Web interface port."; 173 }; 174 175 extraConfig = mkOption { 176 type = types.attrs; 177 default = { }; ··· 180 181 See [the documentation](https://paperless-ngx.readthedocs.io/en/latest/configuration.html) 182 for available options. 183 ''; 184 - example = { 185 - PAPERLESS_OCR_LANGUAGE = "deu+eng"; 186 - PAPERLESS_DBHOST = "/run/postgresql"; 187 - }; 188 }; 189 190 user = mkOption {
··· 26 lib.mapAttrs (_: toString) cfg.extraConfig 27 ); 28 29 + manage = pkgs.writeShellScript "manage" '' 30 + set -o allexport # Export the following env vars 31 + ${lib.toShellVars env} 32 + exec ${pkg}/bin/paperless-ngx "$@" 33 + ''; 34 35 # Secure the services 36 defaultServiceConfig = { ··· 169 description = lib.mdDoc "Web interface port."; 170 }; 171 172 + # FIXME this should become an RFC42-style settings attr 173 extraConfig = mkOption { 174 type = types.attrs; 175 default = { }; ··· 178 179 See [the documentation](https://paperless-ngx.readthedocs.io/en/latest/configuration.html) 180 for available options. 181 + 182 + Note that some options such as `PAPERLESS_CONSUMER_IGNORE_PATTERN` expect JSON values. Use `builtins.toJSON` to ensure proper quoting. 183 ''; 184 + example = literalExpression '' 185 + { 186 + PAPERLESS_OCR_LANGUAGE = "deu+eng"; 187 + 188 + PAPERLESS_DBHOST = "/run/postgresql"; 189 + 190 + PAPERLESS_CONSUMER_IGNORE_PATTERN = builtins.toJSON [ ".DS_STORE/*" "desktop.ini" ]; 191 + 192 + PAPERLESS_OCR_USER_ARGS = builtins.toJSON { 193 + optimize = 1; 194 + pdfa_image_compression = "lossless"; 195 + }; 196 + }; 197 + ''; 198 }; 199 200 user = mkOption {