pub-solar-os/modules/paperless/default.nix

38 lines
977 B
Nix

{ lib, config, pkgs, ... }:
with lib;
let
psCfg = config.pub-solar;
cfg = config.pub-solar.paperless;
xdg = config.home-manager.users."${psCfg.user.name}".xdg;
in
{
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 {
services.paperless = {
enable = true;
user = psCfg.user.name;
consumptionDir = cfg.consumptionDir;
extraConfig = {
PAPERLESS_OCR_LANGUAGE = cfg.ocrLanguage;
PAPERLESS_ADMIN_USER = psCfg.user.name;
PAPERLESS_AUTO_LOGIN_USERNAME = psCfg.user.name;
};
};
};
}