improve module
This commit is contained in:
parent
c8ce4db2a2
commit
3289b801f5
2 changed files with 20 additions and 4 deletions
19
flake.nix
19
flake.nix
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
runtimeInputs = with pkgs; [sane-backends brscan5 ghostscript];
|
runtimeInputs = with pkgs; [sane-backends brscan5 ghostscript];
|
||||||
|
|
||||||
text = builtins.readFile ./scanbuddy.bash;
|
text = builtins.readFile ./scanbuddy.sh;
|
||||||
};
|
};
|
||||||
|
|
||||||
# Returns an attribute set that can be passed to `buildPythonPackage`.
|
# Returns an attribute set that can be passed to `buildPythonPackage`.
|
||||||
|
|
@ -66,10 +66,20 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
options = {
|
options = let
|
||||||
service.scanbuddy = lib.mkEnableOption "Enable the scanbuddy server";
|
inherit (lib) mkOption mkEnableOption types;
|
||||||
|
in {
|
||||||
|
services.scanbuddy = {
|
||||||
|
enable = mkEnableOption "Enable the scanbuddy server";
|
||||||
|
environment = mkOption {
|
||||||
|
type = types.attrsOf (types.nullOr (types.oneOf [types.str types.path types.package]));
|
||||||
|
default = {};
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
config = {
|
config = let
|
||||||
|
cfg = config.services.scanbuddy;
|
||||||
|
in {
|
||||||
systemd.services.scanbuddy = lib.mkIf config.service.scanbuddy {
|
systemd.services.scanbuddy = lib.mkIf config.service.scanbuddy {
|
||||||
description = "The scanbuddy webservice";
|
description = "The scanbuddy webservice";
|
||||||
wantedBy = ["multi-user.target"];
|
wantedBy = ["multi-user.target"];
|
||||||
|
|
@ -78,6 +88,7 @@
|
||||||
Path = ["${scanbuddy-pkg}/bin"];
|
Path = ["${scanbuddy-pkg}/bin"];
|
||||||
WorkingDirectory = "/var/lib/scanbuddy";
|
WorkingDirectory = "/var/lib/scanbuddy";
|
||||||
};
|
};
|
||||||
|
environment = cfg.environment;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,11 @@ dispatch() {
|
||||||
gs -q -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE="$combined_file" -dBATCH "${out_files[@]}"
|
gs -q -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE="$combined_file" -dBATCH "${out_files[@]}"
|
||||||
echo "Merged pdf written to $combined_file"
|
echo "Merged pdf written to $combined_file"
|
||||||
|
|
||||||
|
# TODO
|
||||||
|
if [ ! -v PAPERLESS_TOKEN ]; then
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
|
||||||
# send to paperless
|
# send to paperless
|
||||||
PAPERLESS_STATUS=$(curl \
|
PAPERLESS_STATUS=$(curl \
|
||||||
-H "Authorization: Token $PAPERLESS_TOKEN" \
|
-H "Authorization: Token $PAPERLESS_TOKEN" \
|
||||||
Loading…
Add table
Add a link
Reference in a new issue