python313Packages.ua-parser: 1.0.0 -> 1.0.1 (#379497)
[NixPkgs.git] / pkgs / by-name / el / element-web-unwrapped / package.nix
blobb03d2a2c79a801b5c9fdc745583cb24ea5ae7d09
2   lib,
3   stdenv,
4   fetchFromGitHub,
5   fetchYarnDeps,
6   jq,
7   yarn,
8   fixup-yarn-lock,
9   nodejs,
10   jitsi-meet,
13 let
14   pinData = import ./element-web-pin.nix;
15   inherit (pinData.hashes) webSrcHash webYarnHash;
16   noPhoningHome = {
17     disable_guests = true; # disable automatic guest account registration at matrix.org
18   };
20 stdenv.mkDerivation (
21   finalAttrs:
22   builtins.removeAttrs pinData [ "hashes" ]
23   // {
24     pname = "element-web";
26     src = fetchFromGitHub {
27       owner = "element-hq";
28       repo = "element-web";
29       rev = "v${finalAttrs.version}";
30       hash = webSrcHash;
31     };
33     offlineCache = fetchYarnDeps {
34       yarnLock = finalAttrs.src + "/yarn.lock";
35       sha256 = webYarnHash;
36     };
38     nativeBuildInputs = [
39       yarn
40       fixup-yarn-lock
41       jq
42       nodejs
43     ];
45     buildPhase = ''
46       runHook preBuild
48       export VERSION=${finalAttrs.version}
49       yarn --offline build:res
50       yarn --offline build:module_system
51       yarn --offline build:bundle
53       runHook postBuild
54     '';
56     configurePhase = ''
57       runHook preConfigure
59       export HOME=$PWD/tmp
60       # with the update of openssl3, some key ciphers are not supported anymore
61       # this flag will allow those codecs again as a workaround
62       # see https://medium.com/the-node-js-collection/node-js-17-is-here-8dba1e14e382#5f07
63       # and https://github.com/element-hq/element-web/issues/21043
64       export NODE_OPTIONS=--openssl-legacy-provider
65       mkdir -p $HOME
67       fixup-yarn-lock yarn.lock
68       yarn config --offline set yarn-offline-mirror $offlineCache
69       yarn install --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive
70       patchShebangs node_modules
72       runHook postConfigure
73     '';
75     installPhase = ''
76       runHook preInstall
78       cp -R webapp $out
79       tar --extract --to-stdout --file ${jitsi-meet.src} jitsi-meet/libs/external_api.min.js > $out/jitsi_external_api.min.js
80       echo "${finalAttrs.version}" > "$out/version"
81       jq -s '.[0] * $conf' "config.sample.json" --argjson "conf" '${builtins.toJSON noPhoningHome}' > "$out/config.json"
83       runHook postInstall
84     '';
86     meta = {
87       description = "Glossy Matrix collaboration client for the web";
88       homepage = "https://element.io/";
89       changelog = "https://github.com/element-hq/element-web/blob/v${finalAttrs.version}/CHANGELOG.md";
90       maintainers = lib.teams.matrix.members;
91       license = lib.licenses.asl20;
92       platforms = lib.platforms.all;
93     };
94   }