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 and the teeworlds module in the official Nix expression collection.
Inside your flake.nix
, you can start by adding the following lines.
{
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.
{ inputs, ... }: {
imports = with inputs; [ nix-teeworlds.nixosModules.nix-teeworlds ];
nixpkgs.overlays = with inputs; [ nix-teeworlds.overlays.default ];
}
If you want to help the project, you can follow the guidelines in CONTRIBUTING.md.
All packages written in 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 server with the following command.
nix run github:theobori/nix-teeworlds#infclassr-server
The following packages are available.
fixed-ddnet-server
fng2-server
infclassr-server
ddnet-insta-server
You can find examples of how to configure nix-teeworlds
in the folder examples.
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 haveservices.nix-teeworlds.servers.<name>.settings.port = 8304
on the Nix side.
Whether to enable Enable nix-teeworlds servers…
Type: boolean
Default: false
Example: true
Group under which the Teeworlds servers will run.
Type: string
Default: "nix-teeworlds"
Whether to open ports for each server.
Type: boolean
Default: false
Directory where all server-related files will be stored.
Type: string
Default: "/srv/nix-teeworlds"
Attribute set of Teeworlds server configurations.
Each attribute defines a separate server instance with its own settings.
Type: attribute set of (submodule)
Whether to enable Enable this Teeworlds server…
Type: boolean
Default: false
Example: true
Whether to enable this server systemd service unit.
Type: boolean
Default: true
The teeworlds-server package to use.
Type: package
Default: pkgs.teeworlds-server
Custom binary name to use for the server executable.
If null, uses the default from the package.
Type: null or string
Default: null
Server configuration file name.
Type: string
Default: "server.cfg"
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
External console configuration.
Type: submodule
Default: { }
Whether to enable Enable the external console…
Type: boolean
Default: false
Example: true
Time in seconds before the the econ authentication times out.
Type: signed integer
Default: 30
The time a client gets banned if econ authentication fails. 0 just closes the connection.
Type: signed integer
Default: 0
Address to bind the external console to. Anything but ‘localhost’ is dangerous!
Type: string
Default: "localhost"
Adjusts the amount of information in the external console.
Type: signed integer
Default: 1
External console password.
Type: null or string
Default: null
Port to use for the external console.
Type: signed integer
Default: 1234
Additional configuration lines to append to the server configuration.
Type: null or strings concatenated with “\n”
Default: null
Game configuration.
Type: submodule
Default: { }
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
Game type (This setting needs the map to be reloaded in order to take effect).
Type: string
Default: "dm"
Map to use on the server.
Type: string
Default: "dm1"
Maps to rotate between.
Type: string
Default: ""
Swap teams between matches.
Type: boolean
Default: true
Number of matches on each map before rotating.
Type: signed integer
Default: 1
When enabled, players can pause/unpause the game and start the game on warmup via their ready state.
Type: boolean
Default: false
Number of slots to reserve for players.
Type: signed integer
Default: 8
Allow powerups like ninja.
Type: boolean
Default: true
Time needed to respawn after death in tdm gametype.
Type: signed integer
Default: 3
Score limit of the game (0 disables it).
Type: signed integer
Default: 20
Restricts information like health, ammo and armour in spectator mode.
Type: boolean
Default: false
Team damage.
Type: boolean
Default: false
How many minutes to wait before autobalancing teams.
Type: signed integer
Default: 1
Time limit of the game (in case of equal points there will be sudden death) (0 disables).
Type: signed integer
Default: 0
Tournament mode. When enabled, players joins the server as spectator (2=additional restricted spectator chat).
Type: signed integer
Default: 0
Allow voting to move players to spectators.
Type: boolean
Default: true
How many minutes to wait before a player can rejoin after being moved to spectators by vote.
Type: signed integer
Default: 3
Number of seconds to do warmup before match starts (0 disables, -1 all players ready).
Type: signed integer
Default: 0
Whether to open ports in the firewall for this server.
Type: boolean
Default: false
Custom configuration to use instead of the basic one.
Only used when useQuickConfig is enabled.
Type: strings concatenated with “\n”
Default: ""
Remote console console configuration.
Type: submodule
Default: { }
The time a client gets banned if remote console authentication fails. 0 makes it just use kick.
Type: signed integer
Default: 5
Maximum number of tries for remote console authentication.
Type: signed integer
Default: 3
Remote console password for moderators (limited access).
Type: null or string
Default: null
Password to access the remote console (if not set, rcon is disabled).
Type: null or string
Default: null
Settings configuration.
Type: submodule
Default: { }
Whether to enable chat spam protection.
Type: boolean
Default: true
Address to bind.
Type: null or string
Default: null
Port to report to the master servers (e.g. in case of a firewall rename).
Type: signed integer
Default: 0
Use high bandwidth mode. Doubles the bandwidth required for the server. LAN use only.
Type: boolean
Default: false
Server hostname.
Type: null or string
Default: null
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
Kick inactive spectators.
Type: boolean
Default: false
How many minutes to wait before taking care of inactive clients.
Type: signed integer
Default: 3
Number of map data packages a client gets on each request.
Type: signed integer
Default: 8
Number of clients that can be connected to the server at the same time.
Type: signed integer
Default: 12
Maximum number of clients with the same IP that can connect to the server.
Type: signed integer
Default: 4
Message of the day, shown in server info and when joining a server.
Type: null or string
Default: null
Name of the server.
Type: string
Default: "unnamed server"
Password to connect to the server.
Type: null or string
Default: null
Port the server will listen on.
Type: signed integer
Default: 8303
Whether to register this server on the masters servers.
Type: boolean
Default: false
Whether to enable Enable quick configuration…
Type: boolean
Default: false
Example: true
Server votes configuration.
Type: attribute set of (submodule)
Default: { }
List of command to execute when this vote is voted.
Type: list of string
User under which the Teeworlds servers will run.
Type: string
Default: "nix-teeworlds"