Browse Source

Merge branch 'master' of git.cryto.net:joepie91/morph-rc

Sven Slootweg 10 months ago
parent
commit
4337e920ff

+ 41 - 0
configuration/default.nix

@ -8,6 +8,7 @@ let
8 8
					nodeApplication = self.callPackage ./lib/node-application.nix {};
9 9
					unpack = self.callPackage ./lib/unpack.nix {};
10 10
					mobileProxy = self.callPackage ./packages/mobile-proxy { configFile = null; };
11
					matrixRooms = self.callPackage ./packages/matrix-rooms {};
11 12
				};
12 13
			})
13 14
		];
@ -106,6 +107,7 @@ in {
106 107
				"iomfats.cryto.net"
107 108
				"castleroland.cryto.net"
108 109
				"awesomedude.cryto.net"
110
				"matrix-rooms.cryto.net"
109 111
			])
110 112
			(httpsHosts [
111 113
				# "haless.cryto.net"
@ -114,6 +116,7 @@ in {
114 116
				"iomfats.cryto.net"
115 117
				"castleroland.cryto.net"
116 118
				"awesomedude.cryto.net"
119
				"matrix-rooms.cryto.net"
117 120
			])
118 121
		];
119 122
@ -128,6 +131,10 @@ in {
128 131
						return 404;
129 132
					'';
130 133
				};
134
				"modular-matrix.cryto.net" = lib.mkMerge [
135
					(nginxPresets.letsEncrypt)
136
					{ root = ./sources/modular-matrix; }
137
				];
131 138
				"haless.cryto.net" = lib.mkMerge [
132 139
					(nginxPresets.letsEncrypt)
133 140
					{
@ -209,6 +216,10 @@ in {
209 216
					(nginxPresets.letsEncrypt)
210 217
					(nginxPresets.reverseProxy "http://127.0.0.1:3000/")
211 218
				];
219
				"matrix-rooms.cryto.net" = lib.mkMerge [
220
					(nginxPresets.letsEncrypt)
221
					(nginxPresets.reverseProxy "http://127.0.0.1:3842/")
222
				];
212 223
			};
213 224
		};
214 225
@ -271,5 +282,35 @@ in {
271 282
				HOME = "/tmp/mobile-proxy-home";
272 283
			};
273 284
		};
285
286
		users.extraUsers.matrix-rooms = {
287
			description = "mobile-proxy Service User";
288
		};
289
290
		systemd.services.matrix-rooms = let
291
			package = pkgs.cryto.matrixRooms;
292
		in {
293
			description = "Matrix Room List Viewer";
294
			wantedBy = ["multi-user.target"];
295
			after = ["network.target"];
296
297
			serviceConfig = {
298
				ExecStart = "${package}/bin/matrix-room-list-viewer"; /* FIXME: Change binary name in its package.json at some point */
299
				User = "matrix-rooms";
300
				Restart = "on-failure";
301
				PermissionsStartOnly = true;
302
			};
303
304
			# FIXME: Is a fake homes necessary for this application?
305
			preStart = ''
306
				mkdir -m 0700 -p /tmp/matrix-rooms-home
307
				chown matrix-rooms /tmp/matrix-rooms-home
308
			'';
309
310
			environment =  {
311
				HOME = "/tmp/matrix-rooms-home";
312
				NODE_ENV = "production";
313
			};
314
		};
274 315
	};
275 316
}

+ 18 - 0
configuration/packages/matrix-rooms/default.nix

@ -0,0 +1,18 @@
1
{ pkgs, ... }:
2
	pkgs.cryto.nodeApplication {
3
		name = "matrix-rooms";
4
		source = pkgs.stdenv.mkDerivation {
5
			name = "matrix-rooms-application";
6
			src = pkgs.cryto.fetchFromCrytoGit {
7
				owner = "joepie91";
8
				repo = "matrix-room-list-viewer";
9
				rev = "5912b79024cba33ee7e291f325d0286b8304af99";
10
				sha256 = "199in3m3vll0i0qsz869x2q6zqn1xxgyvia3fxnmschvfmybbf8r";
11
			};
12
13
			buildCommand = ''
14
				mkdir -p $out
15
				tar -xzvf $src -C $out
16
			'';
17
		};
18
	}

+ 23 - 0
configuration/sources/modular-matrix/index.html

@ -0,0 +1,23 @@
1
<html lang="en">
2
<head>
3
	<meta charset="UTF-8">
4
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
5
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
6
	<title>Modular Matrix</title>
7
</head>
8
<body>
9
	<h1>Modular Matrix</h1>
10
	<p>
11
		<em><strong>NOTE:</strong> If you're looking for the Matrix website, go to <a href="https://matrix.org">Matrix.org</a>. If you're looking for the Matrix hosting service, go to <a href="https://modular.im/">Modular.im</a>. This project is not affiliated with either of those two.</em>
12
	</p>
13
	<p>
14
		Hi! This will eventually be the website for Modular Matrix, a project to build a modular JavaScript SDK for the <a href="https://matrix.org">Matrix protocol</a>, as an alternative to the <code>matrix-js-sdk</code>.
15
	</p>
16
	<p>
17
		Currently there's not really anything here yet, though you can have a look at the <a href="https://www.npmjs.com/org/modular-matrix?tab=packages">already-published packages</a> if you're curious about how things are going.
18
	</p>
19
	<p>
20
		You can contact me on Matrix as <a href="https://matrix.to/#/@joepie91:pixie.town">@joepie91:pixie.town</a>.
21
	</p>
22
</body>
23
</html>