diff options
-rw-r--r-- | hosts/chaski/configuration.nix | 3 | ||||
-rw-r--r-- | hosts/chaski/services/exneuland.nix | 50 | ||||
-rw-r--r-- | pkgs/exneuland.nix | 32 |
3 files changed, 84 insertions, 1 deletions
diff --git a/hosts/chaski/configuration.nix b/hosts/chaski/configuration.nix index df1454f..fc9484f 100644 --- a/hosts/chaski/configuration.nix +++ b/hosts/chaski/configuration.nix @@ -9,7 +9,8 @@ [ # Include the results of the hardware scan. ./hardware-configuration.nix ./services/grafana.nix - ./services/workadventure.nix + # ./services/workadventure.nix + ./services/exneuland.nix ]; hexchen.deploy = { diff --git a/hosts/chaski/services/exneuland.nix b/hosts/chaski/services/exneuland.nix new file mode 100644 index 0000000..a0c765a --- /dev/null +++ b/hosts/chaski/services/exneuland.nix @@ -0,0 +1,50 @@ +{ config, lib, pkgs, ... }: + +let + workadventure-nix = builtins.fetchGit { + url = "https://stuebinm.eu/git/workadventure-nix"; + ref = "master"; + }; + wapkgs = import "${workadventure-nix.outPath}/wapkgs.nix" { + inherit pkgs; + lib = pkgs.lib; + }; + frontdrv = wapkgs.workadventure-tcm.front.override { + environment = { + PUSHER_URL = "https://exneuland.stuebinm.eu/pusher"; + START_ROOM_URL = "/_/global/world.di.c3voc.de/maps/main.json"; + }; + }; + exneuland = import ../../../pkgs/exneuland.nix; +in +{ + services.nginx = { + enable = true; + recommendedProxySettings = true; + virtualHosts."exneuland.stuebinm.eu" = { + root = "${frontdrv}/dist"; + locations."/_/".tryFiles = "/index.html =404"; + + locations."/pusher" = { + proxyPass = "http://localhost:4000"; + proxyWebsockets = true; + extraConfig = '' + add_header Access-Control-Allow-Origin https://exneuland.stuebinm.eu; + ''; + }; + + enableACME = true; + forceSSL = true; + }; + }; + + systemd.services.exneuland = { + wantedBy = [ "multi-user.target" ]; + after = [ "network.target" ]; + description = "exneuland backend for workadventure"; + serviceConfig = { + ExecStart = "${exneuland}/bin/exneuland start"; + Restart = "always"; + }; + }; +} diff --git a/pkgs/exneuland.nix b/pkgs/exneuland.nix new file mode 100644 index 0000000..9cd4c71 --- /dev/null +++ b/pkgs/exneuland.nix @@ -0,0 +1,32 @@ +let + sources = import ../nix/sources.nix {}; +in + +with import sources.nixpkgs {}; + +let + packages = beam.packagesWith beam.interpreters.erlang; + src = fetchFromGitLab { + owner = "hexchen"; + repo = "exneuland"; + rev = "main"; + sha256 = "0zh1vvjhzaymlngg5armhp6xqrdjmnd29hpf7c3ci03h3rg4snbq"; + }; + + pname = "exneuland"; + version = "0.0.1"; + mixEnv = "prod"; + + mixDeps = packages.fetchMixDeps { + pname = "mix-deps-${pname}"; + inherit src mixEnv version; + sha256 = "0nyips2ky6rmgq3xdhrhg4fnw4m2pmck6p1amw9m7qisdqlxhv25"; + }; + +in (packages.mixRelease.override { + elixir = (import sources.nixpkgs-unstable {}).elixir_1_12; +}) { + inherit src pname version mixEnv mixDeps; + + buildInputs = [ rebar3 protobuf ]; +} |