nixos configs
1# Matchbox server for papermario-dx networking
2{ pkgs, ... }:
3let
4 pkg = pkgs.rustPlatform.buildRustPackage rec {
5 pname = "matchbox_server";
6 version = "0.11.0";
7 src = pkgs.fetchFromGitHub {
8 owner = "johanhelsing";
9 repo = "matchbox";
10 rev = "v${version}";
11 hash = "sha256-fF6SeZhfOkyK1hAWxdcXjf6P6pVJWLlkIUtyGxVrm94=";
12 };
13 buildAndTestSubdir = "matchbox_server";
14 cargoHash = "sha256-ELA9+wTFYxiuG/QLb0oxN5KfVSalWKmKEvzRlxNHQnw=";
15 };
16in {
17 systemd.services.matchbox = {
18 enable = true;
19 wantedBy = [ "multi-user.target" ];
20 after = [ "network.target" ];
21 description = "Matchbox Signalling Server";
22 script = ''
23 ${pkg}/bin/matchbox_server
24 '';
25 serviceConfig = {
26 Type = "simple";
27 };
28 };
29 networking.firewall = {
30 allowedTCPPorts = [ 3536 ];
31 allowedUDPPorts = [ 3536 ];
32 };
33}