From db5549cff702202ba7945467ab08f3c3190067a5 Mon Sep 17 00:00:00 2001 From: Eli Ribble Date: Wed, 31 Jul 2024 17:33:53 -0700 Subject: [PATCH] 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. --- quinn/etc/nixos/configuration.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/quinn/etc/nixos/configuration.nix b/quinn/etc/nixos/configuration.nix index f2f0ad6..5d2fd09 100644 --- a/quinn/etc/nixos/configuration.nix +++ b/quinn/etc/nixos/configuration.nix @@ -246,6 +246,18 @@ # 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? + 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 systemd.tmpfiles.rules = [ "d /mnt/shares/scans 0775 scanner scanner - -"