hopefully it works this time

This commit is contained in:
Aubrey 2024-12-22 01:09:26 -06:00
parent f473e2559f
commit 0cb24a843a
No known key found for this signature in database

115
flake.nix
View file

@ -55,63 +55,68 @@
formatter = alejandra; formatter = alejandra;
} }
) )
// { // flake-utils.lib.eachDefaultSystemPassThrough (system: {
nixosModules.default = {config, lib, pkgs, system, ...}: { nixosModules.default = {
options.services.smo-server = { config,
enable = lib.mkEnableOption "a game server for Super Mario Odyssey Online"; lib,
user = lib.mkOption { pkgs,
type = lib.types.string; ...
description = "The user to start the server with"; }: {
}; options.services.smo-server = {
enableFaker = lib.mkOption { enable = lib.mkEnableOption "a game server for Super Mario Odyssey Online";
type = lib.types.bool; user = lib.mkOption {
default = false; type = lib.types.string;
example = true; description = "The user to start the server with";
description = "Whether to enable the test bot for solo development.";
};
tcpPort = lib.mkOption {
type = lib.types.port;
default = 1027;
description = "The TCP port to host the server on";
};
udpPort = lib.mkOption {
type = lib.types.port;
default = 1027;
description = "The UDP port to host the server on";
};
proximity = {
type = lib.types.attrs;
port = lib.mkOption {
type = lib.types.port;
example = 4433;
description = "The UDP port to host the proximity chat server on";
};
certPath = lib.mkOption {
type = lib.types.path;
example = "cert.pem";
description = "The certificate used for encrypting the WebTransport stream";
};
keyPath = lib.mkOption {
type = lib.types.path;
example = "cert.pem";
description = "The certificate used for encrypting the WebTransport stream";
};
};
}; };
config = lib.mkIf config.services.smo-server.enable { enableFaker = lib.mkOption {
systemd.services.smo-server = with config.services.smo-server; { type = lib.types.bool;
wantedBy = ["multi-user.target"]; default = false;
after = ["network.target"]; example = true;
description = "Start smo-server"; description = "Whether to enable the test bot for solo development.";
serviceConfig = { };
WorkingDirectory = "${self.packages.${system}.default.outPath}"; tcpPort = lib.mkOption {
Type = "simple"; type = lib.types.port;
ExecStart = let default = "1027";
proxRes = 5; description = "The TCP port to host the server on";
in ''${self.packages.${system}.default.outPath}/bin/smo-server -t ${tcpPort} -u ${udpPort}''; };
}; udpPort = lib.mkOption {
type = lib.types.port;
default = "1027";
description = "The UDP port to host the server on";
};
proximity = {
type = lib.types.attrs;
port = lib.mkOption {
type = lib.types.port;
example = "4433";
description = "The UDP port to host the proximity chat server on";
};
certPath = lib.mkOption {
type = lib.types.path;
example = "cert.pem";
description = "The certificate used for encrypting the WebTransport stream";
};
keyPath = lib.mkOption {
type = lib.types.path;
example = "cert.pem";
description = "The certificate used for encrypting the WebTransport stream";
}; };
}; };
}; };
}; config = lib.mkIf config.services.smo-server.enable {
systemd.services.smo-server = with config.services.smo-server; {
wantedBy = ["multi-user.target"];
after = ["network.target"];
description = "Start smo-server";
serviceConfig = {
WorkingDirectory = "${self.packages.${system}.default}";
Type = "simple";
ExecStart = let
proxRes = 5;
in ''${self.packages.${system}.default}/bin/smo-server -t ${tcpPort} -u ${udpPort}'';
};
};
};
};
});
} }