nix-infra/config/hosts/public-web-static/spaceapid.nix

56 lines
1.5 KiB
Nix
Raw Normal View History

{ pkgs-unstable, ... }:
let
spaceapidSrc = builtins.fetchGit {
url = "https://gitlab.hamburg.ccc.de/ccchh/spaceapid.git";
ref = "main";
2023-11-09 19:59:08 +01:00
rev = "25938b6b3a22199e9884c9f18cc3ea41ca75ed46";
};
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";
};
};
}