1{ lib
2, fetchFromGitHub
3, fetchYarnDeps
4, mkYarnPackage
5, baseUrl ? null
6, writeShellScriptBin
7}:
8
9mkYarnPackage rec {
10 pname = "synapse-admin";
11 version = "0.10.0";
12 src = fetchFromGitHub {
13 owner = "Awesome-Technologies";
14 repo = pname;
15 rev = version;
16 sha256 = "sha256-3MC5PCEwYfZzJy9AW9nHTpvU49Lk6wbYC4Rcv9J9MEg=";
17 };
18
19 yarnLock = ./yarn.lock;
20 packageJSON = ./package.json;
21
22 offlineCache = fetchYarnDeps {
23 inherit yarnLock;
24 hash = "sha256-vpCwPL1B+hbIaVSHtlkGjPAteu9BFNNmCTE66CSyFkg=";
25 };
26
27 nativeBuildInputs = [
28 (writeShellScriptBin "git" "echo ${version}")
29 ];
30
31 NODE_ENV = "production";
32 ${if baseUrl != null then "REACT_APP_SERVER" else null} = baseUrl;
33
34 # error:0308010C:digital envelope routines::unsupported
35 NODE_OPTIONS = "--openssl-legacy-provider";
36
37 buildPhase = ''
38 runHook preBuild
39
40 export HOME=$(mktemp -d)
41 yarn --offline run build
42
43 runHook postBuild
44 '';
45
46 distPhase = ''
47 runHook preDist
48
49 cp -r deps/synapse-admin/dist $out
50
51 runHook postDist
52 '';
53
54 dontFixup = true;
55 dontInstall = true;
56
57 meta = with lib; {
58 description = "Admin UI for Synapse Homeservers";
59 homepage = "https://github.com/Awesome-Technologies/synapse-admin";
60 license = licenses.asl20;
61 platforms = platforms.all;
62 maintainers = with maintainers; [ mkg20001 ma27 ];
63 };
64}