diff --git a/configuration/default.nix b/configuration/default.nix index 542ef5c..ded1175 100644 --- a/configuration/default.nix +++ b/configuration/default.nix @@ -8,6 +8,7 @@ let nodeApplication = self.callPackage ./lib/node-application.nix {}; unpack = self.callPackage ./lib/unpack.nix {}; mobileProxy = self.callPackage ./packages/mobile-proxy { configFile = null; }; + matrixRooms = self.callPackage ./packages/matrix-rooms {}; }; }) ]; @@ -106,6 +107,7 @@ in { "iomfats.cryto.net" "castleroland.cryto.net" "awesomedude.cryto.net" + "matrix-rooms.cryto.net" ]) (httpsHosts [ # "haless.cryto.net" @@ -114,6 +116,7 @@ in { "iomfats.cryto.net" "castleroland.cryto.net" "awesomedude.cryto.net" + "matrix-rooms.cryto.net" ]) ]; @@ -128,6 +131,10 @@ in { return 404; ''; }; + "modular-matrix.cryto.net" = lib.mkMerge [ + (nginxPresets.letsEncrypt) + { root = ./sources/modular-matrix; } + ]; "haless.cryto.net" = lib.mkMerge [ (nginxPresets.letsEncrypt) { @@ -209,6 +216,10 @@ in { (nginxPresets.letsEncrypt) (nginxPresets.reverseProxy "http://127.0.0.1:3000/") ]; + "matrix-rooms.cryto.net" = lib.mkMerge [ + (nginxPresets.letsEncrypt) + (nginxPresets.reverseProxy "http://127.0.0.1:3842/") + ]; }; }; @@ -271,5 +282,35 @@ in { HOME = "/tmp/mobile-proxy-home"; }; }; + + users.extraUsers.matrix-rooms = { + description = "mobile-proxy Service User"; + }; + + systemd.services.matrix-rooms = let + package = pkgs.cryto.matrixRooms; + in { + description = "Matrix Room List Viewer"; + wantedBy = ["multi-user.target"]; + after = ["network.target"]; + + serviceConfig = { + ExecStart = "${package}/bin/matrix-room-list-viewer"; /* FIXME: Change binary name in its package.json at some point */ + User = "matrix-rooms"; + Restart = "on-failure"; + PermissionsStartOnly = true; + }; + + # FIXME: Is a fake homes necessary for this application? + preStart = '' + mkdir -m 0700 -p /tmp/matrix-rooms-home + chown matrix-rooms /tmp/matrix-rooms-home + ''; + + environment = { + HOME = "/tmp/matrix-rooms-home"; + NODE_ENV = "production"; + }; + }; }; } diff --git a/configuration/packages/matrix-rooms/default.nix b/configuration/packages/matrix-rooms/default.nix new file mode 100644 index 0000000..e464ff2 --- /dev/null +++ b/configuration/packages/matrix-rooms/default.nix @@ -0,0 +1,18 @@ +{ pkgs, ... }: + pkgs.cryto.nodeApplication { + name = "matrix-rooms"; + source = pkgs.stdenv.mkDerivation { + name = "matrix-rooms-application"; + src = pkgs.cryto.fetchFromCrytoGit { + owner = "joepie91"; + repo = "matrix-room-list-viewer"; + rev = "5912b79024cba33ee7e291f325d0286b8304af99"; + sha256 = "199in3m3vll0i0qsz869x2q6zqn1xxgyvia3fxnmschvfmybbf8r"; + }; + + buildCommand = '' + mkdir -p $out + tar -xzvf $src -C $out + ''; + }; + } diff --git a/configuration/sources/modular-matrix/index.html b/configuration/sources/modular-matrix/index.html new file mode 100644 index 0000000..e43703b --- /dev/null +++ b/configuration/sources/modular-matrix/index.html @@ -0,0 +1,23 @@ + + + + + + Modular Matrix + + +

Modular Matrix

+

+ NOTE: If you're looking for the Matrix website, go to Matrix.org. If you're looking for the Matrix hosting service, go to Modular.im. This project is not affiliated with either of those two. +

+

+ Hi! This will eventually be the website for Modular Matrix, a project to build a modular JavaScript SDK for the Matrix protocol, as an alternative to the matrix-js-sdk. +

+

+ Currently there's not really anything here yet, though you can have a look at the already-published packages if you're curious about how things are going. +

+

+ You can contact me on Matrix as @joepie91:pixie.town. +

+ +