infrastructure/modules/nixos/syncplay.nix
arcnmx 725a981d23 chore(ci): flake update
syncplay module was updated
2024-09-07 11:41:55 -07:00

44 lines
1.2 KiB
Nix

{
pkgs,
config,
gensokyo-zone,
lib,
...
}: let
inherit (gensokyo-zone.lib) mkAlmostOptionDefault;
inherit (lib.options) mkOption;
inherit (lib.modules) mkIf;
cfg = config.services.syncplay;
in {
options.services.syncplay = with lib.types; {
openFirewall = mkOption {
type = bool;
default = false;
};
};
config.networking.firewall = mkIf cfg.enable {
allowedTCPPorts = mkIf cfg.openFirewall [cfg.port];
};
config.systemd.services.syncplay = mkIf cfg.enable {
wants = mkIf (cfg.useACMEHost != null) ["acme-finished-${cfg.useACMEHost}.target"];
after = mkIf (cfg.useACMEHost != null) ["acme-selfsigned-${cfg.useACMEHost}.service"];
confinement = {
enable = mkAlmostOptionDefault true;
packages = config.systemd.services.syncplay.path;
};
path = mkIf (cfg.passwordFile != null || cfg.saltFile != null) [pkgs.coreutils];
serviceConfig = {
NoNewPrivileges = true;
PrivateDevices = true;
PrivateMounts = true;
PrivateTmp = true;
ProtectSystem = "strict";
ProtectHome = true;
ProtectControlGroups = true;
ProtectProc = "invisible";
RemoveIPC = true;
};
};
}