2023-01-28 21:27:52 +00:00
|
|
|
{
|
2023-10-07 14:45:42 +00:00
|
|
|
flake,
|
2023-01-28 21:27:52 +00:00
|
|
|
lib,
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
with lib; let
|
2022-02-14 09:49:49 +00:00
|
|
|
psCfg = config.pub-solar;
|
|
|
|
xdg = config.home-manager.users."${psCfg.user.name}".xdg;
|
2023-08-29 11:56:18 +00:00
|
|
|
|
2023-10-07 14:45:42 +00:00
|
|
|
dataDir = "${xdg.dataHome}/Paperless";
|
|
|
|
consumptionDir = "/home/${psCfg.user.name}/.local/share/scandir";
|
|
|
|
scannerDefaultDevice = "hp3900:libusb:005:004";
|
|
|
|
in {
|
|
|
|
services.paperless = {
|
|
|
|
enable = true;
|
|
|
|
user = psCfg.user.name;
|
|
|
|
consumptionDir = consumptionDir;
|
|
|
|
dataDir = dataDir;
|
|
|
|
address = "paperless.local";
|
|
|
|
extraConfig = {
|
|
|
|
PAPERLESS_OCR_LANGUAGE = "nld+deu";
|
|
|
|
PAPERLESS_ADMIN_USER = psCfg.user.name;
|
|
|
|
PAPERLESS_AUTO_LOGIN_USERNAME = psCfg.user.name;
|
|
|
|
PAPERLESS_URL = "http://paperless.local";
|
2023-02-07 14:56:19 +00:00
|
|
|
};
|
2022-02-14 09:49:49 +00:00
|
|
|
};
|
|
|
|
|
2023-10-07 14:45:42 +00:00
|
|
|
users.users."${psCfg.user.name}".packages = with pkgs; [
|
|
|
|
scan2paperless
|
|
|
|
sane-backends
|
|
|
|
python310Packages.img2pdf
|
|
|
|
];
|
2023-02-07 14:56:19 +00:00
|
|
|
|
2023-10-07 14:45:42 +00:00
|
|
|
home-manager.users."${psCfg.user.name}" = {
|
|
|
|
home.sessionVariables = {
|
|
|
|
SCANNER_DEFAULT_DEVICE = scannerDefaultDevice;
|
|
|
|
SCANNER_OUTPUT_DIR = consumptionDir;
|
2022-02-14 09:49:49 +00:00
|
|
|
};
|
2023-10-07 14:45:42 +00:00
|
|
|
systemd.user.sessionVariables = {
|
|
|
|
SCANNER_DEFAULT_DEVICE = scannerDefaultDevice;
|
|
|
|
SCANNER_OUTPUT_DIR = consumptionDir;
|
2023-08-29 11:56:18 +00:00
|
|
|
};
|
2022-02-14 09:49:49 +00:00
|
|
|
};
|
2023-10-07 14:45:42 +00:00
|
|
|
|
|
|
|
networking.hosts = flake.self.lib.addLocalHostname ["paperless.local"];
|
2023-10-07 19:11:08 +00:00
|
|
|
services.caddy = {
|
|
|
|
enable = true;
|
|
|
|
extraConfig = ''
|
|
|
|
paperless.local:80 {
|
|
|
|
request_header Host localhost:${builtins.toString config.services.paperless.port}
|
|
|
|
reverse_proxy localhost:${builtins.toString config.services.paperless.port}
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
};
|
2022-02-14 09:49:49 +00:00
|
|
|
}
|