An open API service indexing awesome lists of open source software.

https://github.com/theobori/nix-teeworlds

A Teeworlds server-side management for the Nix ecosystem
https://github.com/theobori/nix-teeworlds

nix nix-flake nixos-module teeworlds-server

Last synced: 7 days ago
JSON representation

A Teeworlds server-side management for the Nix ecosystem

Awesome Lists containing this project

README

          

# Nix Teeworlds

[![check](https://github.com/theobori/nix-teeworlds/actions/workflows/check.yml/badge.svg)](https://github.com/theobori/nix-teeworlds/actions/workflows/check.yml)

The aim of this project is to be able to declare Teeworlds servers in Nix. To achieve this, this repository provides various Nix expressions, including a NixOS module, packages for different Teeworlds game modes and default overlays adding these packages.

The module is designed to be flexible, so it's entirely possible to use your own Teeworlds resources, such as a custom data folder, your own server configuration, your own packages and much more.

The NixOS `nix-teeworlds` module is inspired by [nix-minecraft](https://github.com/Infinidoge/nix-minecraft) and the [teeworlds](https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/games/teeworlds.nix) module in the official Nix expression collection.

## Installation

Inside your `flake.nix`, you can start by adding the following lines.

```nix
{
inputs = {
nix-teeworlds.url = "github:theobori/nix-teeworlds";
};
}
```

You can then include the module and its default overlay in the system configuration as shown below.

```nix
{ inputs, ... }: {
imports = with inputs; [ nix-teeworlds.nixosModules.nix-teeworlds ];
nixpkgs.overlays = with inputs; [ nix-teeworlds.overlays.default ];
}
```

## Contribute

If you want to help the project, you can follow the guidelines in [CONTRIBUTING.md](./CONTRIBUTING.md).

## Packages

All packages written in [packages](./packages) are compatible with the `nix run` command, even without specifying a Teeworlds server configuration file (like `autoexec.cfg`).

For example, you could create an [infclassR](https://github.com/infclass/teeworlds-infclassR) server with the following command.

```bash
nix run github:theobori/nix-teeworlds#infclassr-server
```

The following packages are available.
- `fixed-ddnet-server`
- `fng2-server`
- `infclassr-server`
- `ddnet-insta-server`

## Examples

You can find examples of how to configure `nix-teeworlds` in the folder [examples](./examples).

## Module

> Make sure that all ports specified in a server configuration are also specified in the Nix configuration. Otherwise, they will not be authorized by the firewall.
> For example, if you have `sv_port 8304`, you must also have `services.nix-teeworlds.servers..settings.port = 8304` on the Nix side.

### `services.nix-teeworlds.enable`

Whether to enable Enable nix-teeworlds servers…

*Type:* boolean

*Default:* `false`

*Example:* `true`

### `services.nix-teeworlds.group`

Group under which the Teeworlds servers will run.

*Type:* string

*Default:* `"nix-teeworlds"`

### `services.nix-teeworlds.openFirewall`

Whether to open ports for each server.

*Type:* boolean

*Default:* `false`

### `services.nix-teeworlds.rootDir`

Directory where all server-related files will be stored.

*Type:* string

*Default:* `"/srv/nix-teeworlds"`

### `services.nix-teeworlds.servers`

Attribute set of Teeworlds server configurations.

Each attribute defines a separate server instance with its own settings.

*Type:* attribute set of (submodule)

### `services.nix-teeworlds.servers..enable`

Whether to enable Enable this Teeworlds server…

*Type:* boolean

*Default:* `false`

*Example:* `true`

### `services.nix-teeworlds.servers..enableService`

Whether to enable this server systemd service unit.

*Type:* boolean

*Default:* `true`

### `services.nix-teeworlds.servers..package`

The teeworlds-server package to use.

*Type:* package

*Default:* `pkgs.teeworlds-server`

### `services.nix-teeworlds.servers..binaryName`

Custom binary name to use for the server executable.

If null, uses the default from the package.

*Type:* null or string

*Default:* `null`

### `services.nix-teeworlds.servers..cfgName`

Server configuration file name.

*Type:* string

*Default:* `"server.cfg"`

### `services.nix-teeworlds.servers..dataDir`

Custom data directory path for the server.

If null, uses the default from the package.

*Type:* null or path or package or string

*Default:* `null`

### `services.nix-teeworlds.servers..externalConsole`

External console configuration.

*Type:* submodule

*Default:* `{ }`

### `services.nix-teeworlds.servers..externalConsole.enable`

Whether to enable Enable the external console…

*Type:* boolean

*Default:* `false`

*Example:* `true`

### `services.nix-teeworlds.servers..externalConsole.authTimeout`

Time in seconds before the the econ authentication times out.

*Type:* signed integer

*Default:* `30`

### `services.nix-teeworlds.servers..externalConsole.banTime`

The time a client gets banned if econ authentication fails. 0 just closes the connection.

*Type:* signed integer

*Default:* `0`

### `services.nix-teeworlds.servers..externalConsole.bindAddr`

Address to bind the external console to. Anything but ‘localhost’ is dangerous!

*Type:* string

*Default:* `"localhost"`

### `services.nix-teeworlds.servers..externalConsole.outputLevel`

Adjusts the amount of information in the external console.

*Type:* signed integer

*Default:* `1`

### `services.nix-teeworlds.servers..externalConsole.password`

External console password.

*Type:* null or string

*Default:* `null`

### `services.nix-teeworlds.servers..externalConsole.port`

Port to use for the external console.

*Type:* signed integer

*Default:* `1234`

### `services.nix-teeworlds.servers..extraConfig`

Additional configuration lines to append to the server configuration.

*Type:* null or strings concatenated with “\\n”

*Default:* `null`

### `services.nix-teeworlds.servers..game`

Game configuration.

*Type:* submodule

*Default:* `{ }`

### `services.nix-teeworlds.servers..game.countdown`

Number of seconds to freeze the game in a countdown before match starts (0 enables only for survival gamemodes, -1 disables).

*Type:* signed integer

*Default:* `0`

### `services.nix-teeworlds.servers..game.gameType`

Game type (This setting needs the map to be reloaded in order to take effect).

*Type:* string

*Default:* `"dm"`

### `services.nix-teeworlds.servers..game.map`

Map to use on the server.

*Type:* string

*Default:* `"dm1"`

### `services.nix-teeworlds.servers..game.mapRotation`

Maps to rotate between.

*Type:* string

*Default:* `""`

### `services.nix-teeworlds.servers..game.matchSwap`

Swap teams between matches.

*Type:* boolean

*Default:* `true`

### `services.nix-teeworlds.servers..game.matchesPerMap`

Number of matches on each map before rotating.

*Type:* signed integer

*Default:* `1`

### `services.nix-teeworlds.servers..game.playerReadyMode`

When enabled, players can pause/unpause the game and start the game on warmup via their ready state.

*Type:* boolean

*Default:* `false`

### `services.nix-teeworlds.servers..game.playerSlots`

Number of slots to reserve for players.

*Type:* signed integer

*Default:* `8`

### `services.nix-teeworlds.servers..game.powerups`

Allow powerups like ninja.

*Type:* boolean

*Default:* `true`

### `services.nix-teeworlds.servers..game.respawnDelayTDM`

Time needed to respawn after death in tdm gametype.

*Type:* signed integer

*Default:* `3`

### `services.nix-teeworlds.servers..game.scoreLimit`

Score limit of the game (0 disables it).

*Type:* signed integer

*Default:* `20`

### `services.nix-teeworlds.servers..game.strictSpectateMode`

Restricts information like health, ammo and armour in spectator mode.

*Type:* boolean

*Default:* `false`

### `services.nix-teeworlds.servers..game.teamDamage`

Team damage.

*Type:* boolean

*Default:* `false`

### `services.nix-teeworlds.servers..game.teambalanceTime`

How many minutes to wait before autobalancing teams.

*Type:* signed integer

*Default:* `1`

### `services.nix-teeworlds.servers..game.timeLimit`

Time limit of the game (in case of equal points there will be sudden death) (0 disables).

*Type:* signed integer

*Default:* `0`

### `services.nix-teeworlds.servers..game.tournamentMode`

Tournament mode. When enabled, players joins the server as spectator (2=additional restricted spectator chat).

*Type:* signed integer

*Default:* `0`

### `services.nix-teeworlds.servers..game.voteSpectate`

Allow voting to move players to spectators.

*Type:* boolean

*Default:* `true`

### `services.nix-teeworlds.servers..game.voteSpectateRejoinDelay`

How many minutes to wait before a player can rejoin after being moved to spectators by vote.

*Type:* signed integer

*Default:* `3`

### `services.nix-teeworlds.servers..game.warmup`

Number of seconds to do warmup before match starts (0 disables, -1 all players ready).

*Type:* signed integer

*Default:* `0`

### `services.nix-teeworlds.servers..openFirewall`

Whether to open ports in the firewall for this server.

*Type:* boolean

*Default:* `false`

### `services.nix-teeworlds.servers..quickConfig`

Custom configuration to use instead of the basic one.

Only used when useQuickConfig is enabled.

*Type:* strings concatenated with “\\n”

*Default:* `""`

### `services.nix-teeworlds.servers..remoteConsole`

Remote console console configuration.

*Type:* submodule

*Default:* `{ }`

### `services.nix-teeworlds.servers..remoteConsole.rconBanTime`

The time a client gets banned if remote console authentication fails. 0 makes it just use kick.

*Type:* signed integer

*Default:* `5`

### `services.nix-teeworlds.servers..remoteConsole.rconMaxTries`

Maximum number of tries for remote console authentication.

*Type:* signed integer

*Default:* `3`

### `services.nix-teeworlds.servers..remoteConsole.rconModPassword`

Remote console password for moderators (limited access).

*Type:* null or string

*Default:* `null`

### `services.nix-teeworlds.servers..remoteConsole.rconPassword`

Password to access the remote console (if not set, rcon is disabled).

*Type:* null or string

*Default:* `null`

### `services.nix-teeworlds.servers..settings`

Settings configuration.

*Type:* submodule

*Default:* `{ }`

### `services.nix-teeworlds.servers..settings.enableSpamProtection`

Whether to enable chat spam protection.

*Type:* boolean

*Default:* `true`

### `services.nix-teeworlds.servers..settings.bindAddress`

Address to bind.

*Type:* null or string

*Default:* `null`

### `services.nix-teeworlds.servers..settings.externalPort`

Port to report to the master servers (e.g. in case of a firewall rename).

*Type:* signed integer

*Default:* `0`

### `services.nix-teeworlds.servers..settings.highBandwidth`

Use high bandwidth mode. Doubles the bandwidth required for the server. LAN use only.

*Type:* boolean

*Default:* `false`

### `services.nix-teeworlds.servers..settings.hostname`

Server hostname.

*Type:* null or string

*Default:* `null`

### `services.nix-teeworlds.servers..settings.inactiveKick`

How to deal with inactive clients (1=move player to spectator, 2=move to free spectator slot/kick, 3=kick).

*Type:* one of 1, 2, 3

*Default:* `2`

### `services.nix-teeworlds.servers..settings.inactiveKickSpec`

Kick inactive spectators.

*Type:* boolean

*Default:* `false`

### `services.nix-teeworlds.servers..settings.inactiveKickTime`

How many minutes to wait before taking care of inactive clients.

*Type:* signed integer

*Default:* `3`

### `services.nix-teeworlds.servers..settings.mapDownloadSpeed`

Number of map data packages a client gets on each request.

*Type:* signed integer

*Default:* `8`

### `services.nix-teeworlds.servers..settings.maxClients`

Number of clients that can be connected to the server at the same time.

*Type:* signed integer

*Default:* `12`

### `services.nix-teeworlds.servers..settings.maxClientsPerIp`

Maximum number of clients with the same IP that can connect to the server.

*Type:* signed integer

*Default:* `4`

### `services.nix-teeworlds.servers..settings.motd`

Message of the day, shown in server info and when joining a server.

*Type:* null or string

*Default:* `null`

### `services.nix-teeworlds.servers..settings.name`

Name of the server.

*Type:* string

*Default:* `"unnamed server"`

### `services.nix-teeworlds.servers..settings.password`

Password to connect to the server.

*Type:* null or string

*Default:* `null`

### `services.nix-teeworlds.servers..settings.port`

Port the server will listen on.

*Type:* signed integer

*Default:* `8303`

### `services.nix-teeworlds.servers..settings.register`

Whether to register this server on the masters servers.

*Type:* boolean

*Default:* `false`

### `services.nix-teeworlds.servers..useQuickConfig`

Whether to enable Enable quick configuration…

*Type:* boolean

*Default:* `false`

*Example:* `true`

### `services.nix-teeworlds.servers..votes`

Server votes configuration.

*Type:* attribute set of (submodule)

*Default:* `{ }`

### `services.nix-teeworlds.servers..votes..commands`

List of command to execute when this vote is voted.

*Type:* list of string

### `services.nix-teeworlds.user`

User under which the Teeworlds servers will run.

*Type:* string

*Default:* `"nix-teeworlds"`