nix/README.md

99 lines
2.7 KiB
Markdown

# Spire nix packages
A set of tf2 related nix packages
## Packages
The following is currently packaged:
- `ambuild`
- `sourcepawn`
- `metamod-source`
- `sourcemod`
- [`sourcemod-include-library`](https://github.com/JoinedSenses/SourceMod-IncludeLibrary)
- [`sourcemod-include-curl`](https://github.com/sapphonie/SM-neocurl-ext)
- `sourcemod-include-steamworks`
- `srcds-tf2`
## TF2 Dedicated server
The `srcds-tf2` package contains the TF2 dedicated server.
You can start a basic server with
`nix run .#srcds-tf2 -- -enablefakeip +map cp_badlands`, once it's done loading
you can get the SDR ip using `status` (it will start with `169.254`), and
connect to it from your client.
### Writable tf directory
When running the server directly from the nix store, the tf directory will be
read only. Which is likely to cause issues as various things try to write to the
directory during normal operations. To work around this, you can either copy it
out of the nix store into a normal directory and make it writable, setup a
writable overlayfs, or try to configure tf2 to only write outside the tf
directory (unsure if this is feasible).
### Maps
To save space, `cp_badlands` is the only map bundled with `srcds-tf2`. If you
need additional maps you need to either manually add them to the server, or use
a plugin like [`mapdownloader`](https://codeberg.org/spire/mapdownloader) to
automatically download maps on demand;
## Sourcemod SDKs
For the `sourcemod` package, you need to enable one or more SDKs at build time.
The SDKs are packaged under the `hl2sdk` package and can be enabled like in the
following example.
```nix
pkgs.sourcemod.override {sdks = {inherit (pkgs.hl2sdk) tf2;};};
```
### Supported SDKs
Note that while all the sdks listed below are all packages under `hl2sdk`,
sourcemod doesn't support all of them.
#### i686-linux
`episode1`, `orangebox`, `css`, `hl2dm`, `dods`, `sdk2013`, `tf2`, `l4d`,
`l4d2`, `nucleardawn`, `csgo`, `insurgency`, `bms` and `doi`
#### x86_64-linux
`mcv`, `blade`, `csgo`, `tf2`, `cs2`, `sdk2013`, `dota`, `dods`, `hl2dm`,
`deadlock`, `insurgency` and `css`
## Building sourcepawn script
```nix
buildSourcePawnScript {
name = "test";
src = ./test.sp;
};
```
By default, the sourcemod includes are available.
Additional includes can be added by setting the `includes` argument to an array
of packages containing an `include` folder containing the `.inc` files. This
flake packages a number of common includes and a helper is provided to create
include packages:
```nix
sourcepawn.buildInclude [./cURL.inc ./cURL_header.inc]
```
```nix
buildSourcePawnScript {
name = "test";
src = ./test.sp;
includes = [
pkgs.sourcemod-include-curl
(
sourcepawn.buildInclude [./custom.inc]
)
];
};
```