nixpkgs/pkgs/applications/networking/instant-messengers/element/element-web.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

87 lines
2.1 KiB
Nix
Raw Normal View History

{ lib
, mkYarnPackage
, runCommand
, fetchFromGitHub
, fetchYarnDeps
, writeText
, jq
, yarn
, fixup_yarn_lock
2022-06-15 16:17:57 +00:00
, jitsi-meet
, conf ? { }
}:
2017-08-26 18:49:07 +00:00
let
pinData = lib.importJSON ./pin.json;
noPhoningHome = {
disable_guests = true; # disable automatic guest account registration at matrix.org
piwik = false; # disable analytics
};
configOverrides = writeText "element-config-overrides.json" (builtins.toJSON (noPhoningHome // conf));
in
mkYarnPackage rec {
pname = "element-web";
inherit (pinData) version;
2017-08-26 18:49:07 +00:00
src = fetchFromGitHub {
owner = "vector-im";
repo = pname;
rev = "v${version}";
sha256 = pinData.webSrcHash;
2017-08-26 18:49:07 +00:00
};
packageJSON = ./element-web-package.json;
# Remove the matrix-analytics-events dependency from the matrix-react-sdk
# dependencies list. It doesn't seem to be necessary since we already are
# installing it individually, and it causes issues with the offline mode.
yarnLock = (runCommand "${pname}-modified-lock" {} ''
sed '/matrix-analytics-events "github/d' ${src}/yarn.lock > "$out"
'');
offlineCache = fetchYarnDeps {
inherit yarnLock;
sha256 = pinData.webYarnHash;
};
nativeBuildInputs = [ jq ];
configurePhase = ''
runHook preConfigure
ln -s $node_modules node_modules
runHook postConfigure
'';
buildPhase = ''
runHook preBuild
export VERSION=${version}
yarn build:res --offline
yarn build:bundle --offline
runHook postBuild
'';
installPhase = ''
2019-12-10 14:54:05 +00:00
runHook preInstall
cp -R webapp $out
2022-06-15 16:17:57 +00:00
cp ${jitsi-meet}/libs/external_api.min.js $out/jitsi_external_api.min.js
echo "${version}" > "$out/version"
jq -s '.[0] * .[1]' "config.sample.json" "${configOverrides}" > "$out/config.json"
2019-12-10 14:54:05 +00:00
runHook postInstall
2017-08-26 18:49:07 +00:00
'';
# Do not attempt generating a tarball for element-web again.
doDist = false;
2017-08-26 18:49:07 +00:00
meta = {
description = "A glossy Matrix collaboration client for the web";
homepage = "https://element.io/";
changelog = "https://github.com/vector-im/element-web/blob/v${version}/CHANGELOG.md";
2021-01-15 05:42:41 +00:00
maintainers = lib.teams.matrix.members;
license = lib.licenses.asl20;
platforms = lib.platforms.all;
2017-08-26 18:49:07 +00:00
};
}