2021-05-13 14:42:22 +00:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
let
|
2022-04-12 15:48:53 +00:00
|
|
|
cfg = config.services.paperless;
|
2022-09-05 08:03:59 +00:00
|
|
|
pkg = cfg.package;
|
2021-05-13 14:42:22 +00:00
|
|
|
|
|
|
|
defaultUser = "paperless";
|
2023-02-09 21:59:50 +00:00
|
|
|
nltkDir = "/var/cache/paperless/nltk";
|
2023-08-05 18:45:07 +00:00
|
|
|
defaultFont = "${pkgs.liberation_ttf}/share/fonts/truetype/LiberationSerif-Regular.ttf";
|
2021-05-13 14:42:22 +00:00
|
|
|
|
2022-04-12 15:46:57 +00:00
|
|
|
# Don't start a redis instance if the user sets a custom redis connection
|
|
|
|
enableRedis = !hasAttr "PAPERLESS_REDIS" cfg.extraConfig;
|
2022-04-12 15:48:53 +00:00
|
|
|
redisServer = config.services.redis.servers.paperless;
|
2021-12-22 19:24:43 +00:00
|
|
|
|
2021-05-13 14:42:22 +00:00
|
|
|
env = {
|
|
|
|
PAPERLESS_DATA_DIR = cfg.dataDir;
|
|
|
|
PAPERLESS_MEDIA_ROOT = cfg.mediaDir;
|
|
|
|
PAPERLESS_CONSUMPTION_DIR = cfg.consumptionDir;
|
2023-02-09 21:59:50 +00:00
|
|
|
PAPERLESS_NLTK_DIR = nltkDir;
|
2023-08-05 18:45:07 +00:00
|
|
|
PAPERLESS_THUMBNAIL_FONT_NAME = defaultFont;
|
2021-05-13 14:42:22 +00:00
|
|
|
GUNICORN_CMD_ARGS = "--bind=${cfg.address}:${toString cfg.port}";
|
2022-09-10 20:10:06 +00:00
|
|
|
} // optionalAttrs (config.time.timeZone != null) {
|
|
|
|
PAPERLESS_TIME_ZONE = config.time.timeZone;
|
2022-09-04 11:50:17 +00:00
|
|
|
} // optionalAttrs enableRedis {
|
2022-04-12 15:46:57 +00:00
|
|
|
PAPERLESS_REDIS = "unix://${redisServer.unixSocket}";
|
2022-09-10 20:10:06 +00:00
|
|
|
} // (
|
|
|
|
lib.mapAttrs (_: toString) cfg.extraConfig
|
|
|
|
);
|
2021-05-13 14:42:22 +00:00
|
|
|
|
2023-07-07 15:48:48 +00:00
|
|
|
manage = pkgs.writeShellScript "manage" ''
|
|
|
|
set -o allexport # Export the following env vars
|
|
|
|
${lib.toShellVars env}
|
|
|
|
exec ${pkg}/bin/paperless-ngx "$@"
|
|
|
|
'';
|
2021-05-13 14:42:22 +00:00
|
|
|
|
|
|
|
# Secure the services
|
|
|
|
defaultServiceConfig = {
|
2023-10-04 20:03:18 +00:00
|
|
|
ReadWritePaths = [
|
2021-05-13 14:42:22 +00:00
|
|
|
cfg.consumptionDir
|
|
|
|
cfg.dataDir
|
|
|
|
cfg.mediaDir
|
|
|
|
];
|
2023-02-09 21:59:50 +00:00
|
|
|
CacheDirectory = "paperless";
|
2021-05-13 14:42:22 +00:00
|
|
|
CapabilityBoundingSet = "";
|
|
|
|
# ProtectClock adds DeviceAllow=char-rtc r
|
|
|
|
DeviceAllow = "";
|
|
|
|
LockPersonality = true;
|
|
|
|
MemoryDenyWriteExecute = true;
|
|
|
|
NoNewPrivileges = true;
|
|
|
|
PrivateDevices = true;
|
|
|
|
PrivateMounts = true;
|
2021-12-22 19:24:43 +00:00
|
|
|
PrivateNetwork = true;
|
2021-05-13 14:42:22 +00:00
|
|
|
PrivateTmp = true;
|
|
|
|
PrivateUsers = true;
|
|
|
|
ProtectClock = true;
|
|
|
|
# Breaks if the home dir of the user is in /home
|
|
|
|
# ProtectHome = true;
|
|
|
|
ProtectHostname = true;
|
2023-10-04 20:03:18 +00:00
|
|
|
ProtectSystem = "strict";
|
2021-05-13 14:42:22 +00:00
|
|
|
ProtectControlGroups = true;
|
|
|
|
ProtectKernelLogs = true;
|
|
|
|
ProtectKernelModules = true;
|
|
|
|
ProtectKernelTunables = true;
|
|
|
|
ProtectProc = "invisible";
|
2022-04-11 15:06:03 +00:00
|
|
|
# Don't restrict ProcSubset because django-q requires read access to /proc/stat
|
|
|
|
# to query CPU and memory information.
|
|
|
|
# Note that /proc only contains processes of user `paperless`, so this is safe.
|
|
|
|
# ProcSubset = "pid";
|
2021-08-23 20:30:54 +00:00
|
|
|
RestrictAddressFamilies = [ "AF_UNIX" "AF_INET" "AF_INET6" ];
|
2021-05-13 14:42:22 +00:00
|
|
|
RestrictNamespaces = true;
|
|
|
|
RestrictRealtime = true;
|
|
|
|
RestrictSUIDSGID = true;
|
2022-04-12 15:46:57 +00:00
|
|
|
SupplementaryGroups = optional enableRedis redisServer.user;
|
2021-05-13 14:42:22 +00:00
|
|
|
SystemCallArchitectures = "native";
|
2022-09-22 06:14:21 +00:00
|
|
|
SystemCallFilter = [ "@system-service" "~@privileged @setuid @keyring" ];
|
2023-06-28 14:48:25 +00:00
|
|
|
UMask = "0066";
|
2021-05-13 14:42:22 +00:00
|
|
|
};
|
|
|
|
in
|
|
|
|
{
|
2023-06-27 23:45:26 +00:00
|
|
|
meta.maintainers = with maintainers; [ erikarvstedt Flakebi leona ];
|
2021-05-13 14:42:22 +00:00
|
|
|
|
2021-06-03 13:59:17 +00:00
|
|
|
imports = [
|
2022-04-12 15:48:53 +00:00
|
|
|
(mkRenamedOptionModule [ "services" "paperless-ng" ] [ "services" "paperless" ])
|
2021-06-03 13:59:17 +00:00
|
|
|
];
|
|
|
|
|
2022-04-12 15:48:53 +00:00
|
|
|
options.services.paperless = {
|
2021-05-13 14:42:22 +00:00
|
|
|
enable = mkOption {
|
|
|
|
type = lib.types.bool;
|
|
|
|
default = false;
|
|
|
|
description = lib.mdDoc ''
|
2022-04-12 15:48:53 +00:00
|
|
|
Enable Paperless.
|
2021-05-13 14:42:22 +00:00
|
|
|
|
|
|
|
When started, the Paperless database is automatically created if it doesn't
|
|
|
|
exist and updated if the Paperless package has changed.
|
|
|
|
Both tasks are achieved by running a Django migration.
|
|
|
|
|
|
|
|
A script to manage the Paperless instance (by wrapping Django's manage.py) is linked to
|
2022-04-12 15:48:53 +00:00
|
|
|
`''${dataDir}/paperless-manage`.
|
2021-05-13 14:42:22 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
dataDir = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "/var/lib/paperless";
|
|
|
|
description = lib.mdDoc "Directory to store the Paperless data.";
|
|
|
|
};
|
|
|
|
|
|
|
|
mediaDir = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "${cfg.dataDir}/media";
|
2021-10-03 16:06:03 +00:00
|
|
|
defaultText = literalExpression ''"''${dataDir}/media"'';
|
2021-05-13 14:42:22 +00:00
|
|
|
description = lib.mdDoc "Directory to store the Paperless documents.";
|
|
|
|
};
|
|
|
|
|
|
|
|
consumptionDir = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "${cfg.dataDir}/consume";
|
2021-10-03 16:06:03 +00:00
|
|
|
defaultText = literalExpression ''"''${dataDir}/consume"'';
|
2021-05-13 14:42:22 +00:00
|
|
|
description = lib.mdDoc "Directory from which new documents are imported.";
|
|
|
|
};
|
|
|
|
|
|
|
|
consumptionDirIsPublic = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = lib.mdDoc "Whether all users can write to the consumption dir.";
|
|
|
|
};
|
|
|
|
|
|
|
|
passwordFile = mkOption {
|
|
|
|
type = types.nullOr types.path;
|
|
|
|
default = null;
|
2022-04-12 15:48:53 +00:00
|
|
|
example = "/run/keys/paperless-password";
|
2021-05-13 14:42:22 +00:00
|
|
|
description = lib.mdDoc ''
|
|
|
|
A file containing the superuser password.
|
|
|
|
|
|
|
|
A superuser is required to access the web interface.
|
|
|
|
If unset, you can create a superuser manually by running
|
2022-04-12 15:48:53 +00:00
|
|
|
`''${dataDir}/paperless-manage createsuperuser`.
|
2021-05-13 14:42:22 +00:00
|
|
|
|
|
|
|
The default superuser name is `admin`. To change it, set
|
|
|
|
option {option}`extraConfig.PAPERLESS_ADMIN_USER`.
|
|
|
|
WARNING: When changing the superuser name after the initial setup, the old superuser
|
|
|
|
will continue to exist.
|
|
|
|
|
|
|
|
To disable login for the web interface, set the following:
|
|
|
|
`extraConfig.PAPERLESS_AUTO_LOGIN_USERNAME = "admin";`.
|
|
|
|
WARNING: Only use this on a trusted system without internet access to Paperless.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
address = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "localhost";
|
|
|
|
description = lib.mdDoc "Web interface address.";
|
|
|
|
};
|
|
|
|
|
|
|
|
port = mkOption {
|
|
|
|
type = types.port;
|
|
|
|
default = 28981;
|
|
|
|
description = lib.mdDoc "Web interface port.";
|
|
|
|
};
|
|
|
|
|
2023-07-09 17:47:58 +00:00
|
|
|
# FIXME this should become an RFC42-style settings attr
|
2021-05-13 14:42:22 +00:00
|
|
|
extraConfig = mkOption {
|
|
|
|
type = types.attrs;
|
2023-02-09 21:36:39 +00:00
|
|
|
default = { };
|
2021-05-13 14:42:22 +00:00
|
|
|
description = lib.mdDoc ''
|
2022-04-12 15:48:53 +00:00
|
|
|
Extra paperless config options.
|
2021-05-13 14:42:22 +00:00
|
|
|
|
2023-07-26 16:57:17 +00:00
|
|
|
See [the documentation](https://docs.paperless-ngx.com/configuration/)
|
2021-05-13 14:42:22 +00:00
|
|
|
for available options.
|
2023-07-09 17:47:58 +00:00
|
|
|
|
|
|
|
Note that some options such as `PAPERLESS_CONSUMER_IGNORE_PATTERN` expect JSON values. Use `builtins.toJSON` to ensure proper quoting.
|
|
|
|
'';
|
|
|
|
example = literalExpression ''
|
|
|
|
{
|
|
|
|
PAPERLESS_OCR_LANGUAGE = "deu+eng";
|
|
|
|
|
|
|
|
PAPERLESS_DBHOST = "/run/postgresql";
|
|
|
|
|
|
|
|
PAPERLESS_CONSUMER_IGNORE_PATTERN = builtins.toJSON [ ".DS_STORE/*" "desktop.ini" ];
|
|
|
|
|
|
|
|
PAPERLESS_OCR_USER_ARGS = builtins.toJSON {
|
|
|
|
optimize = 1;
|
|
|
|
pdfa_image_compression = "lossless";
|
|
|
|
};
|
|
|
|
};
|
2021-05-13 14:42:22 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
user = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = defaultUser;
|
|
|
|
description = lib.mdDoc "User under which Paperless runs.";
|
|
|
|
};
|
|
|
|
|
2023-11-27 00:19:27 +00:00
|
|
|
package = mkPackageOption pkgs "paperless-ngx" { };
|
2021-05-13 14:42:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2022-04-12 15:48:53 +00:00
|
|
|
services.redis.servers.paperless.enable = mkIf enableRedis true;
|
2021-05-13 14:42:22 +00:00
|
|
|
|
|
|
|
systemd.tmpfiles.rules = [
|
|
|
|
"d '${cfg.dataDir}' - ${cfg.user} ${config.users.users.${cfg.user}.group} - -"
|
|
|
|
"d '${cfg.mediaDir}' - ${cfg.user} ${config.users.users.${cfg.user}.group} - -"
|
|
|
|
(if cfg.consumptionDirIsPublic then
|
|
|
|
"d '${cfg.consumptionDir}' 777 - - - -"
|
|
|
|
else
|
|
|
|
"d '${cfg.consumptionDir}' - ${cfg.user} ${config.users.users.${cfg.user}.group} - -"
|
|
|
|
)
|
|
|
|
];
|
|
|
|
|
2022-04-12 15:48:53 +00:00
|
|
|
systemd.services.paperless-scheduler = {
|
2022-12-25 23:07:17 +00:00
|
|
|
description = "Paperless Celery Beat";
|
2023-01-02 14:22:37 +00:00
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
wants = [ "paperless-consumer.service" "paperless-web.service" "paperless-task-queue.service" ];
|
2021-05-13 14:42:22 +00:00
|
|
|
serviceConfig = defaultServiceConfig // {
|
|
|
|
User = cfg.user;
|
2022-12-25 23:07:17 +00:00
|
|
|
ExecStart = "${pkg}/bin/celery --app paperless beat --loglevel INFO";
|
2021-05-13 14:42:22 +00:00
|
|
|
Restart = "on-failure";
|
|
|
|
};
|
|
|
|
environment = env;
|
|
|
|
|
|
|
|
preStart = ''
|
2022-04-12 15:48:53 +00:00
|
|
|
ln -sf ${manage} ${cfg.dataDir}/paperless-manage
|
2021-05-13 14:42:22 +00:00
|
|
|
|
|
|
|
# Auto-migrate on first run or if the package has changed
|
|
|
|
versionFile="${cfg.dataDir}/src-version"
|
2023-01-30 19:20:16 +00:00
|
|
|
version=$(cat "$versionFile" 2>/dev/null || echo 0)
|
|
|
|
|
|
|
|
if [[ $version != ${pkg.version} ]]; then
|
2022-09-05 08:03:59 +00:00
|
|
|
${pkg}/bin/paperless-ngx migrate
|
2023-01-30 19:20:16 +00:00
|
|
|
|
|
|
|
# Parse old version string format for backwards compatibility
|
|
|
|
version=$(echo "$version" | grep -ohP '[^-]+$')
|
|
|
|
|
|
|
|
versionLessThan() {
|
|
|
|
target=$1
|
|
|
|
[[ $({ echo "$version"; echo "$target"; } | sort -V | head -1) != "$target" ]]
|
|
|
|
}
|
|
|
|
|
|
|
|
if versionLessThan 1.12.0; then
|
|
|
|
# Reindex documents as mentioned in https://github.com/paperless-ngx/paperless-ngx/releases/tag/v1.12.1
|
|
|
|
echo "Reindexing documents, to allow searching old comments. Required after the 1.12.x upgrade."
|
|
|
|
${pkg}/bin/paperless-ngx document_index reindex
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo ${pkg.version} > "$versionFile"
|
2021-05-13 14:42:22 +00:00
|
|
|
fi
|
|
|
|
''
|
|
|
|
+ optionalString (cfg.passwordFile != null) ''
|
|
|
|
export PAPERLESS_ADMIN_USER="''${PAPERLESS_ADMIN_USER:-admin}"
|
|
|
|
export PAPERLESS_ADMIN_PASSWORD=$(cat "${cfg.dataDir}/superuser-password")
|
|
|
|
superuserState="$PAPERLESS_ADMIN_USER:$PAPERLESS_ADMIN_PASSWORD"
|
|
|
|
superuserStateFile="${cfg.dataDir}/superuser-state"
|
|
|
|
|
|
|
|
if [[ $(cat "$superuserStateFile" 2>/dev/null) != $superuserState ]]; then
|
2022-09-05 08:03:59 +00:00
|
|
|
${pkg}/bin/paperless-ngx manage_superuser
|
2021-05-13 14:42:22 +00:00
|
|
|
echo "$superuserState" > "$superuserStateFile"
|
|
|
|
fi
|
|
|
|
'';
|
2022-04-12 15:46:57 +00:00
|
|
|
} // optionalAttrs enableRedis {
|
2022-04-12 15:48:53 +00:00
|
|
|
after = [ "redis-paperless.service" ];
|
2021-05-13 14:42:22 +00:00
|
|
|
};
|
|
|
|
|
2022-12-25 23:07:17 +00:00
|
|
|
systemd.services.paperless-task-queue = {
|
|
|
|
description = "Paperless Celery Workers";
|
2023-01-02 14:22:37 +00:00
|
|
|
after = [ "paperless-scheduler.service" ];
|
2022-12-25 23:07:17 +00:00
|
|
|
serviceConfig = defaultServiceConfig // {
|
|
|
|
User = cfg.user;
|
|
|
|
ExecStart = "${pkg}/bin/celery --app paperless worker --loglevel INFO";
|
|
|
|
Restart = "on-failure";
|
|
|
|
# The `mbind` syscall is needed for running the classifier.
|
|
|
|
SystemCallFilter = defaultServiceConfig.SystemCallFilter ++ [ "mbind" ];
|
|
|
|
# Needs to talk to mail server for automated import rules
|
|
|
|
PrivateNetwork = false;
|
|
|
|
};
|
|
|
|
environment = env;
|
|
|
|
};
|
|
|
|
|
2022-04-11 15:06:02 +00:00
|
|
|
# Reading the user-provided password file requires root access
|
2022-04-12 15:48:53 +00:00
|
|
|
systemd.services.paperless-copy-password = mkIf (cfg.passwordFile != null) {
|
|
|
|
requiredBy = [ "paperless-scheduler.service" ];
|
|
|
|
before = [ "paperless-scheduler.service" ];
|
2021-05-13 14:42:22 +00:00
|
|
|
serviceConfig = {
|
|
|
|
ExecStart = ''
|
|
|
|
${pkgs.coreutils}/bin/install --mode 600 --owner '${cfg.user}' --compare \
|
|
|
|
'${cfg.passwordFile}' '${cfg.dataDir}/superuser-password'
|
|
|
|
'';
|
|
|
|
Type = "oneshot";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-02-09 21:59:50 +00:00
|
|
|
# Download NLTK corpus data
|
|
|
|
systemd.services.paperless-download-nltk-data = {
|
|
|
|
wantedBy = [ "paperless-scheduler.service" ];
|
|
|
|
before = [ "paperless-scheduler.service" ];
|
|
|
|
after = [ "network-online.target" ];
|
|
|
|
serviceConfig = defaultServiceConfig // {
|
|
|
|
User = cfg.user;
|
|
|
|
Type = "oneshot";
|
|
|
|
# Enable internet access
|
|
|
|
PrivateNetwork = false;
|
|
|
|
ExecStart = let pythonWithNltk = pkg.python.withPackages (ps: [ ps.nltk ]); in ''
|
|
|
|
${pythonWithNltk}/bin/python -m nltk.downloader -d '${nltkDir}' punkt snowball_data stopwords
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-04-12 15:48:53 +00:00
|
|
|
systemd.services.paperless-consumer = {
|
2021-05-13 14:42:22 +00:00
|
|
|
description = "Paperless document consumer";
|
2023-01-02 14:22:37 +00:00
|
|
|
# Bind to `paperless-scheduler` so that the consumer never runs
|
|
|
|
# during migrations
|
|
|
|
bindsTo = [ "paperless-scheduler.service" ];
|
|
|
|
after = [ "paperless-scheduler.service" ];
|
2021-05-13 14:42:22 +00:00
|
|
|
serviceConfig = defaultServiceConfig // {
|
|
|
|
User = cfg.user;
|
2022-09-05 08:03:59 +00:00
|
|
|
ExecStart = "${pkg}/bin/paperless-ngx document_consumer";
|
2021-05-13 14:42:22 +00:00
|
|
|
Restart = "on-failure";
|
|
|
|
};
|
|
|
|
environment = env;
|
|
|
|
};
|
|
|
|
|
2022-04-12 15:48:53 +00:00
|
|
|
systemd.services.paperless-web = {
|
2021-05-13 14:42:22 +00:00
|
|
|
description = "Paperless web server";
|
2023-01-02 14:22:37 +00:00
|
|
|
# Bind to `paperless-scheduler` so that the web server never runs
|
|
|
|
# during migrations
|
|
|
|
bindsTo = [ "paperless-scheduler.service" ];
|
|
|
|
after = [ "paperless-scheduler.service" ];
|
2023-10-18 16:01:34 +00:00
|
|
|
# Setup PAPERLESS_SECRET_KEY.
|
|
|
|
# If this environment variable is left unset, paperless-ngx defaults
|
|
|
|
# to a well-known value, which is insecure.
|
|
|
|
script = let
|
|
|
|
secretKeyFile = "${cfg.dataDir}/nixos-paperless-secret-key";
|
|
|
|
in ''
|
|
|
|
if [[ ! -f '${secretKeyFile}' ]]; then
|
|
|
|
(
|
|
|
|
umask 0377
|
|
|
|
tr -dc A-Za-z0-9 < /dev/urandom | head -c64 | ${pkgs.moreutils}/bin/sponge '${secretKeyFile}'
|
|
|
|
)
|
|
|
|
fi
|
|
|
|
export PAPERLESS_SECRET_KEY=$(cat '${secretKeyFile}')
|
|
|
|
if [[ ! $PAPERLESS_SECRET_KEY ]]; then
|
|
|
|
echo "PAPERLESS_SECRET_KEY is empty, refusing to start."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
exec ${pkg.python.pkgs.gunicorn}/bin/gunicorn \
|
|
|
|
-c ${pkg}/lib/paperless-ngx/gunicorn.conf.py paperless.asgi:application
|
|
|
|
'';
|
2021-05-13 14:42:22 +00:00
|
|
|
serviceConfig = defaultServiceConfig // {
|
|
|
|
User = cfg.user;
|
|
|
|
Restart = "on-failure";
|
|
|
|
|
2022-09-04 11:46:35 +00:00
|
|
|
# gunicorn needs setuid, liblapack needs mbind
|
|
|
|
SystemCallFilter = defaultServiceConfig.SystemCallFilter ++ [ "@setuid mbind" ];
|
2021-12-22 19:24:43 +00:00
|
|
|
# Needs to serve web page
|
|
|
|
PrivateNetwork = false;
|
2022-09-04 14:14:17 +00:00
|
|
|
} // lib.optionalAttrs (cfg.port < 1024) {
|
|
|
|
AmbientCapabilities = [ "CAP_NET_BIND_SERVICE" ];
|
|
|
|
CapabilityBoundingSet = [ "CAP_NET_BIND_SERVICE" ];
|
2021-05-13 14:42:22 +00:00
|
|
|
};
|
|
|
|
environment = env // {
|
2022-09-05 08:12:39 +00:00
|
|
|
PYTHONPATH = "${pkg.python.pkgs.makePythonPath pkg.propagatedBuildInputs}:${pkg}/lib/paperless-ngx/src";
|
2021-05-13 14:42:22 +00:00
|
|
|
};
|
2021-08-23 06:58:16 +00:00
|
|
|
# Allow the web interface to access the private /tmp directory of the server.
|
|
|
|
# This is required to support uploading files via the web interface.
|
2022-12-25 23:07:17 +00:00
|
|
|
unitConfig.JoinsNamespaceOf = "paperless-task-queue.service";
|
2021-05-13 14:42:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
users = optionalAttrs (cfg.user == defaultUser) {
|
|
|
|
users.${defaultUser} = {
|
|
|
|
group = defaultUser;
|
|
|
|
uid = config.ids.uids.paperless;
|
|
|
|
home = cfg.dataDir;
|
|
|
|
};
|
|
|
|
|
|
|
|
groups.${defaultUser} = {
|
|
|
|
gid = config.ids.gids.paperless;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|