snowfield/modules/paperless/default.nix

47 lines
878 B
Nix
Raw Permalink Normal View History

2024-03-30 20:18:12 +01:00
{ lib, config, ... }:
2022-02-26 22:43:10 +01:00
with lib;
let
2022-02-26 23:48:07 +01:00
cfg = config.luj.paperless;
2022-02-26 22:43:10 +01:00
port = 28981;
in
{
2022-02-26 23:48:07 +01:00
options.luj.paperless = {
2022-02-26 22:43:10 +01:00
enable = mkEnableOption "activate paperless service";
user = mkOption {
type = types.str;
default = "paperless";
description = "User account under which Paperless runs.";
};
nginx.enable = mkEnableOption "activate nginx";
nginx.subdomain = mkOption {
type = types.str;
};
};
config = mkIf cfg.enable (
mkMerge [{
2022-06-04 10:12:47 +02:00
services.paperless = {
2022-02-26 22:43:10 +01:00
enable = true;
2024-03-30 20:21:59 +01:00
inherit (cfg) user;
2022-02-26 22:43:10 +01:00
mediaDir = "/home/julien/papers";
extraConfig = {
2022-02-26 23:48:07 +01:00
PAPERLESS_OCR_LANGUAGE = "fra+eng";
2022-02-26 22:43:10 +01:00
PAPERLESS_OCR_MODE = "redo";
PAPERLESS_TIME_ZONE = "Europe/Paris";
};
};
}
(mkIf cfg.nginx.enable (mkVPNSubdomain cfg.nginx.subdomain port))]);
}