aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--instance-options.nix34
-rw-r--r--workadventure.nix10
2 files changed, 15 insertions, 29 deletions
diff --git a/instance-options.nix b/instance-options.nix
index 6c3d6f2..c01932e 100644
--- a/instance-options.nix
+++ b/instance-options.nix
@@ -6,7 +6,13 @@ 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;
@@ -24,13 +30,6 @@ with pkgs;
type = types.ints.u16;
description = "The TCP port the backend will bind to for grpc";
};
-
- package = mkOption {
- default = workadventure-tcm.back;
- defaultText = "third_party.workadventure-nix.back";
- type = types.package;
- description = "Backend package to use";
- };
};
pusher = {
@@ -44,23 +43,9 @@ with pkgs;
type = types.ints.u16;
description = "The TCP port the pusher will bind to";
};
-
- package = mkOption {
- default = workadventure-tcm.pusher;
- defaultText = "third_party.workadventure-nix.pusher";
- type = types.package;
- description = "Pusher package to use";
- };
};
frontend = {
- package = mkOption {
- default = workadventure-tcm.front;
- defaultText = "third_party.workadventure-nix.front";
- type = types.package;
- description = "Front package to use";
- };
-
debugMode = mkOption {
default = false;
description = "Whether or not to run the frontend in debug mode";
@@ -238,9 +223,8 @@ with pkgs;
};
path = mkOption {
default = workadventure-tcm.maps.outPath + "/workadventuremaps/";
- defaultText = "third_party.workadventure-nix.maps";
- type = types.path;
- description = "Maps package to use";
+ 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.";
};
};
};
diff --git a/workadventure.nix b/workadventure.nix
index f73cab8..c972d40 100644
--- a/workadventure.nix
+++ b/workadventure.nix
@@ -56,7 +56,7 @@ let
User = "workadventure-backend";
Group = "workadventure-backend";
DynamicUser = true; # Note: this implies a lot of other security features.
- ExecStart = "${instanceConfig.backend.package}/bin/workadventureback";
+ ExecStart = "${instanceConfig.packageset.back}/bin/workadventureback";
Restart = "always";
RestartSec = "10s";
};
@@ -83,7 +83,7 @@ let
User = "workadventure-pusher";
Group = "workadventure-pusher";
DynamicUser = true;
- ExecStart = "${instanceConfig.pusher.package}/bin/workadventurepusher";
+ ExecStart = "${instanceConfig.packageset.pusher}/bin/workadventurepusher";
Restart = "always";
RestartSec = "10s";
};
@@ -95,7 +95,7 @@ let
let fc = instanceConfig.frontend;
cc = instanceConfig.commonConfig;
in
- fc.package.override {
+ instanceConfig.packageset.front.override {
environment = {
DEBUG_MODE = if fc.debugMode then "true" else "false"; # toString bool behaves weird
START_ROOM_URL = fc.startRoomUrl;
@@ -136,7 +136,9 @@ let
};
"/maps/" = mkIf instanceConfig.nginx.maps.serve {
- alias = instanceConfig.nginx.maps.path;
+ alias = if instanceConfig.nginx.maps.path == null
+ then instanceConfig.packageset.maps.outPath + "/workadventuremaps"
+ else instanceConfig.nginx.maps.path;
};
};
}