Add a simple systemd unit for running the scan uploader

I've manually redacted the api key until I can figure out a solution
that I like for keeping the key out of the configuration itself.

This depends a great deal on setting up the source code in the right
place and the right way. Specifically cloning the repository to
/opt/src/scan-uploader, creating a virtual environment at
/opt/src/scan-uploader/ve and installing the package with `pip install
-e .` such that the `scan-uploader` entrypoint is properly created.
This commit is contained in:
Eli Ribble 2024-07-31 17:33:53 -07:00
parent f9fe2379f4
commit db5549cff7
1 changed files with 12 additions and 0 deletions

View File

@ -246,6 +246,18 @@
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion . # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
system.stateVersion = "24.05"; # Did you read the comment? system.stateVersion = "24.05"; # Did you read the comment?
systemd.services.scan-uploader = {
enable = true;
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
description = "Daemon for uploading scans we get over the network";
serviceConfig = {
User = "scanner";
WorkingDirectory = "/opt/src/scan-uploader";
ExecStart = "/opt/src/scan-uploader/ve/bin/scan-uploader --paperless-url https://docs.theribbles.org --paperless-api-key secret-stuff --backlog /mnt/shares/scans/";
};
};
# Create folders necessary for samba to work # Create folders necessary for samba to work
systemd.tmpfiles.rules = [ systemd.tmpfiles.rules = [
"d /mnt/shares/scans 0775 scanner scanner - -" "d /mnt/shares/scans 0775 scanner scanner - -"