# nas indexer server module { pkgs, ... }: let # Build the catacomb server package catacombServerSource = builtins.fetchGit { url = "https://git.alogoulogoi.com/Jaculabilis/catacomb-server.git"; ref = "develop-nix"; rev = "3d6fb16948c377f94d030648849f120c8ada3884"; }; catacombServer = pkgs.callPackage catacombServerSource { pkgs = import (fetchTarball { url = "https://github.com/NixOS/nixpkgs/archive/405d762a1a05ffed2ac820eb4bae4bc49bc3abf2.tar.gz"; sha256 = "6c835ea038bdfe170029a8bd4276c9d3a95c275159ec05426672fa8092c7947d"; }) { system = "x86_64-linux"; }; }; # Host-mode server run script hostRun = pkgs.writeShellScriptBin "catacomb-run-host.sh" '' ${catacombServer}/bin/gunicorn \ --bind=localhost:5000 \ --workers=3 \ --log-level=debug \ --env CATACOMB_ROOT=/pool/tvb \ --env CATACOMB_MODE=host \ --env CATACOMB_TOKENS=/var/empty \ --env CATACOMB_GUEST_HOST=catacomb.alogoulogoi.com \ "catacomb.server:wsgi()" ''; in { # Set up the host mode service systemd.services."catacomb-host" = { enable = true; description = "catapool host-mode index server"; script = "${hostRun}/bin/catacomb-run-host.sh"; serviceConfig = { Type = "simple"; User = "nginx"; }; requires = [ "zfs.target" ]; wantedBy = [ "multi-user.target" ]; after = [ "network.target" ]; }; }