diff --git a/flake.nix b/flake.nix index 14e66b5..9992d0a 100644 --- a/flake.nix +++ b/flake.nix @@ -55,63 +55,68 @@ formatter = alejandra; } ) - // { - nixosModules.default = {config, lib, pkgs, system, ...}: { - options.services.smo-server = { - enable = lib.mkEnableOption "a game server for Super Mario Odyssey Online"; - user = lib.mkOption { - type = lib.types.string; - description = "The user to start the server with"; - }; - enableFaker = lib.mkOption { - type = lib.types.bool; - default = false; - example = true; - 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"; - }; - }; + // flake-utils.lib.eachDefaultSystemPassThrough (system: { + nixosModules.default = { + config, + lib, + pkgs, + ... + }: { + options.services.smo-server = { + enable = lib.mkEnableOption "a game server for Super Mario Odyssey Online"; + user = lib.mkOption { + type = lib.types.string; + description = "The user to start the server with"; }; - 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.outPath}"; - Type = "simple"; - ExecStart = let - proxRes = 5; - in ''${self.packages.${system}.default.outPath}/bin/smo-server -t ${tcpPort} -u ${udpPort}''; - }; + enableFaker = lib.mkOption { + type = lib.types.bool; + default = false; + example = true; + 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 { + 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}''; + }; + }; + }; + }; + }); }