# Configuration options specific to a single workadventure instance. { lib, pkgs, config, ... }: with lib; with pkgs; { options = rec { packageset = mkOption { default = workadventure-tcm; type = types.attrs; description = "The package set to use. It should contain a front, backend, pusher, and maps package."; }; backend = { enable = mkOption { default = true; type = types.bool; }; httpPort = mkOption { default = 8081; type = types.ints.u16; description = "The TCP port the backend will bind to for http"; }; grpcPort = mkOption { default = 50051; type = types.ints.u16; description = "The TCP port the backend will bind to for grpc"; }; }; pusher = { enable = mkOption { default = true; type = types.bool; }; port = mkOption { default = 8080; type = types.ints.u16; description = "The TCP port the pusher will bind to"; }; }; frontend = { debugMode = mkOption { default = false; description = "Whether or not to run the frontend in debug mode"; type = types.bool; }; startRoomUrl = mkOption { default = "/_/global/localhost/maps/Floor0/floor0.json"; description = "The workadventure map url that users join by default"; type = types.str; }; resolution = mkOption { default = 2; description = "resolution of workadventure"; type = types.int; }; zoomLevel = mkOption { default = 1; description = "The default zoom level of maps"; type = types.int; }; positionDelay = mkOption { default = 200; description = "Delay in milliseconds between sending position events"; type = types.int; }; maxExtrapolationTime = mkOption { default = 100; description = "Maximum time period in which movements of other players are extrapolated"; type = types.int; }; urls = { api = mkOption { default = "/pusher"; type = types.str; description = "The base url for the api, from the browser's point of view"; }; uploader = mkOption { default = "/uploader"; type = types.str; description = "The base url for the uploader, from the browser's point of view"; }; admin = mkOption { default = "/pusher/admin"; type = types.str; description = "The base url for the admin, from the browser's point of view"; }; maps = mkOption { default = "/maps"; type = types.str; description = "The base url for serving maps, from the browser's point of view"; }; }; }; commonConfig = { secretKey = mkOption { default = "THECODINGMACHINE_SECRET_KEY"; type = types.str; }; minimumDistance = mkOption { default = 64; type = types.int; }; groupRadius = mkOption { default = 48; type = types.int; }; allowArtillery = mkOption { default = false; type = types.bool; }; maxUsersPerRoom = mkOption { default = 600; type = types.int; }; cpuOverheatThreshold = mkOption { default = 80; type = types.int; }; socketIdleTime = mkOption { default = 30; type = types.int; }; webrtc = { stun = { url = mkOption { default = "stun:stun.l.google.com:19302"; description = "The STUN server to use for peer connections"; type = types.str; }; }; turn = { url = mkOption { default = "turn:coturn.workadventure.localhost:3478"; description = "The TURN server to use for peer connections"; type = types.str; }; user = mkOption { default = "workadventure"; description = "Username for TURN authentication"; type = types.str; # TODO: also allow no user }; password = mkOption { default = "workadventure"; description = "Password for TURN authentication (will be served to clients!)"; type = types.str; }; staticSecret = mkOption { default = ""; description = "Static Secret for the coturn rest API (not served to clients)"; type = types.str; }; }; }; jitsi = { url = mkOption { default = "meet.jit.si"; description = "Jitsi instance to use for conference rooms"; type = types.str; }; privateMode = mkOption { default = false; description = "Jitsi private mode"; type = types.bool; }; iss = mkOption { default = ""; type = types.str; }; secretKey = mkOption { default = ""; type = types.str; }; }; }; nginx = { enable = mkOption { default = true; type = types.bool; description = "enable nginx as proxy, and for serving maps"; }; default = mkOption { default = false; type = types.bool; description = "Whether this instance will be the default one served by nginx"; }; domain = mkOption { default = "localhost"; type = types.str; description = "The domain name to serve workadenture services under."; }; maps = { serve = mkOption { default = false; type = types.bool; description = "Whether to serve maps through nginx."; }; path = mkOption { default = workadventure-tcm.maps.outPath + "/workadventuremaps/"; type = types.nullOr types.path; description = "Path to a directory which should be served under /maps. If maps are enabled and this path set to null, the default maps provided in the packageset are used instead."; }; }; }; }; }