Update paperless module
This commit is contained in:
parent
c434d1769f
commit
892aa2e4fa
|
@ -79,8 +79,8 @@ in {
|
|||
config.pub-solar.paperless.enable
|
||||
''
|
||||
paperless.local:80 {
|
||||
request_header Host localhost:28981
|
||||
reverse_proxy localhost:28981
|
||||
request_header Host localhost:${builtins.toString config.services.paperless.port}
|
||||
reverse_proxy localhost:${builtins.toString config.services.paperless.port}
|
||||
}
|
||||
'')
|
||||
|
||||
|
|
|
@ -23,6 +23,20 @@ in {
|
|||
example = "/var/lib/paperless/consume";
|
||||
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 {
|
||||
|
@ -30,10 +44,26 @@ in {
|
|||
enable = true;
|
||||
user = psCfg.user.name;
|
||||
consumptionDir = cfg.consumptionDir;
|
||||
address = "paperless.local";
|
||||
extraConfig = {
|
||||
PAPERLESS_OCR_LANGUAGE = cfg.ocrLanguage;
|
||||
PAPERLESS_ADMIN_USER = 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:
|
||||
with self; ''
|
||||
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