{ pkgs-unstable, ... }: let spaceapidSrc = builtins.fetchGit { url = "https://gitlab.hamburg.ccc.de/ccchh/spaceapid.git"; ref = "main"; rev = "ec8e279b7a1ad203919f8af9c8cac84257c8d8b6"; }; spaceapid = pkgs-unstable.buildGoModule { pname = "spaceapid"; version = "main"; src = spaceapidSrc; # Since spaceapid doesn't have any dependencies, we can set this to null and # use the nonexistend vendored dependencies. vendorHash = null; }; in { users.users.spaceapi = { isSystemUser = true; group = "spaceapi"; }; users.groups.spaceapi = { }; systemd.services.spaceapid = { enable = true; description = "Daemon hosting the SpaceAPI"; unitConfig = { Wants = [ "network-online.target" ]; After = [ "network.target" "network-online.target" ]; }; serviceConfig = { ExecStart = "${spaceapid}/bin/spaceapid"; User = "spaceapi"; Group = "spaceapi"; Restart = "on-failure"; Environment = "DOORIS_USERNAME=dooris SPACE_API_JSON_TEMPLATE_PATH=${spaceapidSrc}/ccchh-template.json"; EnvironmentFile = "/secrets/spaceapid-environment-secrets.secret"; }; wantedBy = [ "multi-user.target" ]; }; deployment.keys = { "spaceapid-environment-secrets.secret" = { keyCommand = [ "pass" "noc/vm-secrets/chaosknoten/public-web-static/spaceapid-environment-secrets" ]; destDir = "/secrets"; user = "spaceapi"; group = "spaceapi"; permissions = "0640"; uploadAt = "pre-activation"; }; }; }