Update paperless module
This commit is contained in:
parent
c434d1769f
commit
892aa2e4fa
|
@ -79,8 +79,8 @@ in {
|
||||||
config.pub-solar.paperless.enable
|
config.pub-solar.paperless.enable
|
||||||
''
|
''
|
||||||
paperless.local:80 {
|
paperless.local:80 {
|
||||||
request_header Host localhost:28981
|
request_header Host localhost:${builtins.toString config.services.paperless.port}
|
||||||
reverse_proxy localhost:28981
|
reverse_proxy localhost:${builtins.toString config.services.paperless.port}
|
||||||
}
|
}
|
||||||
'')
|
'')
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,20 @@ in {
|
||||||
example = "/var/lib/paperless/consume";
|
example = "/var/lib/paperless/consume";
|
||||||
default = "/home/${psCfg.user.name}/Documents";
|
default = "/home/${psCfg.user.name}/Documents";
|
||||||
};
|
};
|
||||||
|
scannerDefaultDevice = mkOption {
|
||||||
|
description = '' The scanner device. To find this, use `scanimage -L`.
|
||||||
|
|
||||||
|
For example, your output might be the following:
|
||||||
|
|
||||||
|
```
|
||||||
|
device `v4l:/dev/video3' is a Noname Logitech StreamCam virtual device
|
||||||
|
device `hp3900:libusb:005:002' is a Hewlett-Packard Scanjet G3010 flatbed scanner
|
||||||
|
```
|
||||||
|
|
||||||
|
Here, the scannerDevice is `hp3900:libusb:005:002`.
|
||||||
|
'';
|
||||||
|
type = types.str;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
@ -30,10 +44,26 @@ in {
|
||||||
enable = true;
|
enable = true;
|
||||||
user = psCfg.user.name;
|
user = psCfg.user.name;
|
||||||
consumptionDir = cfg.consumptionDir;
|
consumptionDir = cfg.consumptionDir;
|
||||||
|
address = "paperless.local";
|
||||||
extraConfig = {
|
extraConfig = {
|
||||||
PAPERLESS_OCR_LANGUAGE = cfg.ocrLanguage;
|
PAPERLESS_OCR_LANGUAGE = cfg.ocrLanguage;
|
||||||
PAPERLESS_ADMIN_USER = psCfg.user.name;
|
PAPERLESS_ADMIN_USER = psCfg.user.name;
|
||||||
PAPERLESS_AUTO_LOGIN_USERNAME = psCfg.user.name;
|
PAPERLESS_AUTO_LOGIN_USERNAME = psCfg.user.name;
|
||||||
|
PAPERLESS_URL = "http://paperless.local";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
home-manager = pkgs.lib.setAttrByPath ["users" psCfg.user.name] {
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
scan2paperless
|
||||||
|
];
|
||||||
|
home.sessionVariables = {
|
||||||
|
SCANNER_DEFAULT_DEVICE = cfg.scannerDefaultDevice;
|
||||||
|
SCANNER_OUTPUT_DIR = cfg.consumptionDir;
|
||||||
|
};
|
||||||
|
systemd.user.sessionVariables = {
|
||||||
|
SCANNER_DEFAULT_DEVICE = cfg.scannerDefaultDevice;
|
||||||
|
SCANNER_OUTPUT_DIR = cfg.consumptionDir;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,17 @@
|
||||||
self:
|
self:
|
||||||
with self; ''
|
with self; ''
|
||||||
export PATH=${lib.makeBinPath [pkgs.coreutils pkgs.sane-frontends pkgs.sane-backends pkgs.ghostscript pkgs.imagemagick]}
|
export PATH=${lib.makeBinPath [pkgs.coreutils pkgs.sane-frontends pkgs.sane-backends pkgs.ghostscript pkgs.imagemagick]}
|
||||||
|
|
||||||
|
while true;
|
||||||
|
do
|
||||||
|
read -p "Press Enter to continue or Ctrl+C to stop" < /dev/tty
|
||||||
|
|
||||||
|
DATETIME=$(date -Iseconds)
|
||||||
|
scanimage \
|
||||||
|
-d "''${SCANNER_DEFAULT_DEVICE}" \
|
||||||
|
--format=jpeg \
|
||||||
|
--resolution 300 \
|
||||||
|
--progress \
|
||||||
|
-o "''${SCANNER_OUTPUT_DIR}/''${DATETIME}.jpg"
|
||||||
|
done
|
||||||
''
|
''
|
||||||
|
|
Loading…
Reference in a new issue