1 { config, lib, pkgs, ... }:
4 inherit (lib) concatStringsSep mkEnableOption mkIf mkOption types;
5 cfg = config.services.openarena;
10 enable = mkEnableOption "OpenArena game server";
11 package = lib.mkPackageOption pkgs "openarena" { };
13 openPorts = mkOption {
16 description = "Whether to open firewall ports for OpenArena";
19 extraFlags = mkOption {
20 type = types.listOf types.str;
22 description = "Extra flags to pass to {command}`oa_ded`";
25 "+set sv_hostname 'My NixOS OpenArena Server'"
26 # Load a map. Mandatory for clients to be able to connect.
33 config = mkIf cfg.enable {
34 networking.firewall = mkIf cfg.openPorts {
35 allowedUDPPorts = [ 27960 ];
38 systemd.services.openarena = {
39 description = "OpenArena";
40 wantedBy = [ "multi-user.target" ];
41 after = [ "network.target" ];
45 StateDirectory = "openarena";
46 ExecStart = "${cfg.package}/bin/oa_ded +set fs_basepath ${cfg.package}/share/openarena +set fs_homepath /var/lib/openarena ${concatStringsSep " " cfg.extraFlags}";
47 Restart = "on-failure";
50 CapabilityBoundingSet = "";
51 NoNewPrivileges = true;
52 PrivateDevices = true;