mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 20:39:18 -08:00
61 lines
1.4 KiB
Nix
61 lines
1.4 KiB
Nix
{ config, lib, pkgs, tf, ... }:
|
|
|
|
with lib;
|
|
|
|
{
|
|
|
|
kw.secrets.variables =
|
|
let
|
|
fieldAdapt = field: if field == "pass" then "password" else field;
|
|
in
|
|
mapListToAttrs
|
|
(field:
|
|
nameValuePair "syncplay-${field}" {
|
|
path = "services/media/syncplay";
|
|
field = fieldAdapt field;
|
|
}) [ "pass" "salt" ];
|
|
|
|
users.users.syncplay = { isSystemUser = true; group = "sync-cert"; };
|
|
|
|
users.groups."domain-auth".members = [ "syncplay" ];
|
|
|
|
security.acme = {
|
|
certs."kittywit.ch" = {
|
|
postRun = ''
|
|
cp key.pem privkey.pem
|
|
chown acme:voice-cert privkey.pem
|
|
'';
|
|
};
|
|
};
|
|
|
|
networks.internet.tcp = [ 8999 ];
|
|
|
|
domains.kittywitch-syncplay = {
|
|
network = "internet";
|
|
type = "cname";
|
|
domain = "sync";
|
|
};
|
|
|
|
secrets.files.syncplay-env = {
|
|
text = ''
|
|
SYNCPLAY_PASSWORD=${tf.variables.syncplay-pass.ref}
|
|
SYNCPLAY_SALT=${tf.variables.syncplay-salt.ref}
|
|
'';
|
|
owner = "syncplay";
|
|
group = "sync-cert";
|
|
};
|
|
|
|
systemd.services.syncplay = {
|
|
description = "Syncplay Service";
|
|
wantedBy = singleton "multi-user.target";
|
|
after = singleton "network-online.target";
|
|
|
|
serviceConfig = {
|
|
EnvironmentFile = config.secrets.files.syncplay-env.path;
|
|
ExecStart =
|
|
"${pkgs.syncplay}/bin/syncplay-server --port 8999 --tls /var/lib/acme/sync.${config.network.dns.domain}/ --disable-ready";
|
|
User = "syncplay";
|
|
Group = "sync-cert";
|
|
};
|
|
};
|
|
}
|