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;
|
|
|
|
cfg = config.pub-solar.paperless;
|
|
|
|
xdg = config.home-manager.users."${psCfg.user.name}".xdg;
|
2023-01-28 21:27:52 +00:00
|
|
|
in {
|
2022-02-14 09:49:49 +00:00
|
|
|
options.pub-solar.paperless = {
|
|
|
|
enable = mkEnableOption "All you need to go paperless";
|
|
|
|
ocrLanguage = mkOption {
|
|
|
|
description = "OCR language";
|
|
|
|
type = types.str;
|
|
|
|
example = "eng+deu";
|
|
|
|
default = "eng";
|
|
|
|
};
|
|
|
|
consumptionDir = mkOption {
|
|
|
|
description = "Directory to be watched";
|
|
|
|
type = types.str;
|
|
|
|
example = "/var/lib/paperless/consume";
|
|
|
|
default = "/home/${psCfg.user.name}/Documents";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2022-11-28 10:39:28 +00:00
|
|
|
services.paperless = {
|
2022-02-14 09:49:49 +00:00
|
|
|
enable = true;
|
2022-11-28 10:39:28 +00:00
|
|
|
user = psCfg.user.name;
|
2022-02-14 09:49:49 +00:00
|
|
|
consumptionDir = cfg.consumptionDir;
|
|
|
|
extraConfig = {
|
|
|
|
PAPERLESS_OCR_LANGUAGE = cfg.ocrLanguage;
|
2022-11-28 10:39:28 +00:00
|
|
|
PAPERLESS_ADMIN_USER = psCfg.user.name;
|
|
|
|
PAPERLESS_AUTO_LOGIN_USERNAME = psCfg.user.name;
|
2022-02-14 09:49:49 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|