56 lines
1.5 KiB
Nix
56 lines
1.5 KiB
Nix
{ pkgs-unstable, ... }:
|
|
|
|
let
|
|
spaceapidSrc = builtins.fetchGit {
|
|
url = "https://gitlab.hamburg.ccc.de/ccchh/spaceapid.git";
|
|
ref = "main";
|
|
rev = "1a9922d5f148cc3b315afee7fc43cd3c41e69798";
|
|
};
|
|
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";
|
|
};
|
|
};
|
|
}
|