From 939cad8f30a7621162c104149b48211f3755636f Mon Sep 17 00:00:00 2001 From: stuebinm Date: Thu, 25 Feb 2021 22:52:38 +0100 Subject: Version bump to current coding machine master This broke a lot of things, but possibly they might work again now. --- instance-options.nix | 9 ++++----- workadventure-nix.nix | 31 ------------------------------- workadventure.nix | 32 ++++++++++++++++++++++++++++---- 3 files changed, 32 insertions(+), 40 deletions(-) delete mode 100644 workadventure-nix.nix diff --git a/instance-options.nix b/instance-options.nix index 58cc99e..50d7bdc 100644 --- a/instance-options.nix +++ b/instance-options.nix @@ -3,8 +3,7 @@ { lib, pkgs, config, ... }: with lib; -let workadventure = import ./workadventure-nix.nix { inherit lib pkgs; }; -in +with pkgs; { options = rec { backend = { @@ -85,7 +84,7 @@ in }; admin = mkOption { - default = "/admin"; + default = "/pusher/admin"; type = types.str; description = "The base url for the admin, from the browser's point of view"; }; @@ -115,8 +114,8 @@ in }; domain = mkOption { - default = null; - type = types.nullOr types.str; + default = "localhost"; + type = types.str; description = "The domain name to serve workadenture services under. Mutually exclusive with domains.X"; }; diff --git a/workadventure-nix.nix b/workadventure-nix.nix deleted file mode 100644 index 6e13dd1..0000000 --- a/workadventure-nix.nix +++ /dev/null @@ -1,31 +0,0 @@ -# WorkAdventure packaging effort by SuperSandro2000, not yet upstreamed into nixpkgs. - -{ pkgs, lib, ... }: - - -let - src = pkgs.fetchgit { - url = "https://gitlab.infra4future.de/stuebinm/workadventure-nix"; - rev = "bfae9d9bfa90a0189d943ca865fa046f510b9922"; - sha256 = "160gc1yy6l5ynrx6679b6vwm1ivickymw75w3jfxk8idshsbjqw8"; - }; - - # Use a fixed-point operator to build a nixpkgs-like structure that contains all - # workadventure derivation. - wapkgs = lib.fix (self: let - callPackage = lib.callPackageWith (pkgs // self); - in { - workadventure-pusher = callPackage "${src}/pusher" {}; - workadventure-back = callPackage "${src}/back" {}; - workadventure-front = callPackage "${src}/front" {}; - workadventure-messages = callPackage "${src}/messages" {}; - workadventure-maps = callPackage "${src}/maps" {}; - }); - -# Build public attrset of all accessible components. -in rec { - pusher = wapkgs.workadventure-pusher; - back = wapkgs.workadventure-back; - front = wapkgs.workadventure-front; - maps = wapkgs.workadventure-maps; -} diff --git a/workadventure.nix b/workadventure.nix index 189921c..b1aec77 100644 --- a/workadventure.nix +++ b/workadventure.nix @@ -6,6 +6,22 @@ with lib; let cfg = config.services.workadventure; + + workadventureOverlay = let + src = "/home/stuebinm/Dokumente/Nous Sommes l'Utopie/hacc/workadventure/workadventure-nix"; + #src = pkgs.fetchgit { + # url = "https://gitlab.infra4future.de/stuebinm/workadventure-nix"; + # rev = "7ec4c291d8ec93bc205af5c238dfe6a5176f4da4"; + # sha256 = "1372iwwbw7ji3v1wx3ncx9xiwnmjhahb8ivxcg8ykkci80hj0ci5"; + #}; + in import "${src}/overlay.nix"; + + urls = instanceConfig: if instanceConfig.nginx.domain != null then { + api = instanceConfig.nginx.domain + instanceConfig.frontend.urls.api; + uploader = instanceConfig.nginx.domain + instanceConfig.frontend.urls.uploader; + admin = instanceConfig.nginx.domain + instanceConfig.frontend.urls.admin; + maps = instanceConfig.nginx.domain + instanceConfig.frontend.urls.maps; + } else instanceConfig.urls; servicesBack = mapAttrs' (instanceName: instanceConfig: { name = "wa-back-${instanceName}"; @@ -31,6 +47,9 @@ let environment = { HTTP_PORT = toString instanceConfig.backend.httpPort; GRPC_PORT = toString instanceConfig.backend.grpcPort; + #ADMIN_API_TOKEN = "lalala"; + #ADMIN_API_URL = toString (urls instanceConfig).admin; + #ALLOW_ARTILLERY = "true"; }; serviceConfig = { User = "workadventure-backend"; @@ -56,6 +75,8 @@ let environment = { PUSHER_HTTP_PORT = toString instanceConfig.pusher.port; API_URL = "localhost:${toString instanceConfig.backend.grpcPort}"; + #ADMIN_API_URL = toString (urls instanceConfig).admin; + #ADMIN_API_TOKEN = "lalala"; }; serviceConfig = { User = "workadventure-pusher"; @@ -71,10 +92,10 @@ let frontPackage = mapAttrs (instanceName: instanceConfig: instanceConfig.frontend.package.override { settings = { - apiUrl = instanceConfig.frontend.urls.api; - uploaderUrl = instanceConfig.frontend.urls.uploader; - adminUrl = instanceConfig.frontend.urls.admin; - mapsUrl = instanceConfig.frontend.urls.maps; + apiUrl = (urls instanceConfig).api; + uploaderUrl = (urls instanceConfig).uploader; + adminUrl = (urls instanceConfig).admin; + mapsUrl = (urls instanceConfig).maps; } // instanceConfig.frontend.settings; } ) cfg.instances; @@ -90,7 +111,9 @@ let }; "/pusher/" = { + #proxyPass = "http://10.233.3.1:9000"; proxyPass = "http://localhost:${toString instanceConfig.pusher.port}/"; + proxyWebsockets = true; }; "/maps/" = mkIf instanceConfig.nginx.serveDefaultMaps { @@ -134,5 +157,6 @@ in { inherit virtualHosts; enable = mkDefault true; }; + nixpkgs.overlays = [ workadventureOverlay ]; }; } -- cgit v1.2.3