mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
refactor: move services out of systems/tewi/
This commit is contained in:
parent
2f68968238
commit
5a661e8809
30 changed files with 992 additions and 638 deletions
42
nixos/syncplay.nix
Normal file
42
nixos/syncplay.nix
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
utils,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.services.syncplay;
|
||||
args =
|
||||
[
|
||||
"--disable-ready"
|
||||
"--port"
|
||||
cfg.port
|
||||
]
|
||||
++ optionals (cfg.certDir != null) ["--tls" cfg.certDir];
|
||||
in {
|
||||
sops.secrets.syncplay-env.owner = cfg.user;
|
||||
|
||||
users.users.${cfg.user} = {
|
||||
inherit (cfg) group;
|
||||
isSystemUser = true;
|
||||
home = "/var/lib/syncplay";
|
||||
};
|
||||
users.groups.${cfg.group} = {};
|
||||
|
||||
networking.firewall.allowedTCPPorts = [cfg.port];
|
||||
|
||||
services.syncplay = {
|
||||
enable = true;
|
||||
user = "syncplay";
|
||||
};
|
||||
systemd.services.syncplay = mkIf cfg.enable {
|
||||
serviceConfig = {
|
||||
StateDirectory = "syncplay";
|
||||
EnvironmentFile = singleton config.sops.secrets.syncplay-env.path;
|
||||
ExecStart = mkForce [
|
||||
"${pkgs.syncplay-nogui}/bin/syncplay-server ${utils.escapeSystemdExecArgs args}"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue