2023-06-12 15:07:55 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
with lib; let
|
|
|
|
psCfg = config.pub-solar;
|
|
|
|
cfg = config.pub-solar.paperless;
|
|
|
|
in {
|
2023-10-28 23:23:14 +00:00
|
|
|
imports = [
|
|
|
|
./container.nix
|
|
|
|
./nginx.nix
|
|
|
|
];
|
2023-06-12 15:07:55 +00:00
|
|
|
|
|
|
|
options.pub-solar.paperless = {
|
|
|
|
enable = mkEnableOption {default = false;};
|
|
|
|
openFirewall = mkEnableOption (lib.mdDoc "opening of the relay port(s) in the firewall");
|
|
|
|
|
|
|
|
domain = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "paperless.local";
|
|
|
|
};
|
|
|
|
|
2023-10-28 23:23:14 +00:00
|
|
|
path = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
description = "Sets the path to listen on. Use empty string to listen on root.";
|
|
|
|
default = "";
|
|
|
|
};
|
|
|
|
|
2023-06-12 15:07:55 +00:00
|
|
|
hostStateDir = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "/var/lib/paperless-container";
|
|
|
|
};
|
|
|
|
|
|
|
|
listenPort = mkOption {
|
|
|
|
type = types.int;
|
|
|
|
default = 80;
|
|
|
|
};
|
|
|
|
|
|
|
|
# ftp
|
|
|
|
ftp = {
|
|
|
|
enable = mkEnableOption (lib.mdDoc ''enable vsftpd ftp service'');
|
|
|
|
listenPort = mkOption {
|
|
|
|
type = types.int;
|
|
|
|
default = 21;
|
|
|
|
};
|
|
|
|
pasvMinPort = mkOption {
|
|
|
|
type = types.int;
|
|
|
|
default = 20021;
|
|
|
|
};
|
|
|
|
pasvMaxPort = mkOption {
|
|
|
|
type = types.int;
|
|
|
|
default = 22021;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
# nextcloud
|
|
|
|
nextcloud = {
|
|
|
|
enable = mkEnableOption (lib.mdDoc ''enable backup to nextcloud'');
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
networking.firewall = {
|
|
|
|
allowedTCPPorts = [
|
|
|
|
cfg.listenPort
|
|
|
|
cfg.ftp.listenPort
|
|
|
|
];
|
|
|
|
|
|
|
|
allowedTCPPortRanges = [
|
|
|
|
{
|
|
|
|
from = cfg.ftp.pasvMinPort;
|
|
|
|
to = cfg.ftp.pasvMaxPort;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|