forked from mirrors/nixpkgs
Merge pull request #200336 from linsui/element-23b
element-web: export unwrapped
This commit is contained in:
commit
7a79aed149
|
@ -0,0 +1,26 @@
|
|||
{ stdenv
|
||||
, jq
|
||||
, element-web-unwrapped
|
||||
, conf ? { }
|
||||
}:
|
||||
|
||||
if (conf == { }) then element-web-unwrapped else
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "${element-web-unwrapped.pname}-wrapped";
|
||||
inherit (element-web-unwrapped) version meta;
|
||||
|
||||
dontUnpack = true;
|
||||
|
||||
nativeBuildInputs = [ jq ];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out
|
||||
ln -s ${element-web-unwrapped}/* $out
|
||||
rm $out/config.json
|
||||
jq -s '.[0] * $conf' "${element-web-unwrapped}/config.json" --argjson "conf" '${builtins.toJSON conf}' > "$out/config.json"
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
}
|
|
@ -9,7 +9,6 @@
|
|||
, fixup_yarn_lock
|
||||
, nodejs
|
||||
, jitsi-meet
|
||||
, conf ? { }
|
||||
}:
|
||||
|
||||
let
|
||||
|
@ -17,93 +16,72 @@ let
|
|||
noPhoningHome = {
|
||||
disable_guests = true; # disable automatic guest account registration at matrix.org
|
||||
};
|
||||
|
||||
unwrapped = stdenv.mkDerivation rec {
|
||||
pname = "element-web";
|
||||
inherit (pinData) version;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "vector-im";
|
||||
repo = pname;
|
||||
rev = "v${version}";
|
||||
sha256 = pinData.webSrcHash;
|
||||
};
|
||||
|
||||
offlineCache = fetchYarnDeps {
|
||||
yarnLock = src + "/yarn.lock";
|
||||
sha256 = pinData.webYarnHash;
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ yarn fixup_yarn_lock jq nodejs ];
|
||||
|
||||
configurePhase = ''
|
||||
runHook preConfigure
|
||||
|
||||
export HOME=$PWD/tmp
|
||||
# with the update of openssl3, some key ciphers are not supported anymore
|
||||
# this flag will allow those codecs again as a workaround
|
||||
# see https://medium.com/the-node-js-collection/node-js-17-is-here-8dba1e14e382#5f07
|
||||
# and https://github.com/vector-im/element-web/issues/21043
|
||||
export NODE_OPTIONS=--openssl-legacy-provider
|
||||
mkdir -p $HOME
|
||||
|
||||
fixup_yarn_lock yarn.lock
|
||||
yarn config --offline set yarn-offline-mirror $offlineCache
|
||||
yarn install --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive
|
||||
patchShebangs node_modules
|
||||
|
||||
runHook postConfigure
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
export VERSION=${version}
|
||||
yarn build:res --offline
|
||||
yarn build:module_system --offline
|
||||
yarn build:bundle --offline
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
cp -R webapp $out
|
||||
cp ${jitsi-meet}/libs/external_api.min.js $out/jitsi_external_api.min.js
|
||||
echo "${version}" > "$out/version"
|
||||
jq -s '.[0] * $conf' "config.sample.json" --argjson "conf" '${builtins.toJSON noPhoningHome}' > "$out/config.json"
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
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";
|
||||
maintainers = lib.teams.matrix.members;
|
||||
license = lib.licenses.asl20;
|
||||
platforms = lib.platforms.all;
|
||||
};
|
||||
};
|
||||
in
|
||||
if (conf == { }) then unwrapped else
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "${unwrapped.pname}-wrapped";
|
||||
inherit (unwrapped) version meta;
|
||||
pname = "element-web";
|
||||
inherit (pinData) version;
|
||||
|
||||
dontUnpack = true;
|
||||
src = fetchFromGitHub {
|
||||
owner = "vector-im";
|
||||
repo = pname;
|
||||
rev = "v${version}";
|
||||
sha256 = pinData.webSrcHash;
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ jq ];
|
||||
offlineCache = fetchYarnDeps {
|
||||
yarnLock = src + "/yarn.lock";
|
||||
sha256 = pinData.webYarnHash;
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ yarn fixup_yarn_lock jq nodejs ];
|
||||
|
||||
configurePhase = ''
|
||||
runHook preConfigure
|
||||
|
||||
export HOME=$PWD/tmp
|
||||
# with the update of openssl3, some key ciphers are not supported anymore
|
||||
# this flag will allow those codecs again as a workaround
|
||||
# see https://medium.com/the-node-js-collection/node-js-17-is-here-8dba1e14e382#5f07
|
||||
# and https://github.com/vector-im/element-web/issues/21043
|
||||
export NODE_OPTIONS=--openssl-legacy-provider
|
||||
mkdir -p $HOME
|
||||
|
||||
fixup_yarn_lock yarn.lock
|
||||
yarn config --offline set yarn-offline-mirror $offlineCache
|
||||
yarn install --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive
|
||||
patchShebangs node_modules
|
||||
|
||||
runHook postConfigure
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
export VERSION=${version}
|
||||
yarn build:res --offline
|
||||
yarn build:module_system --offline
|
||||
yarn build:bundle --offline
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out
|
||||
ln -s ${unwrapped}/* $out
|
||||
rm $out/config.json
|
||||
jq -s '.[0] * $conf' "${unwrapped}/config.json" --argjson "conf" '${builtins.toJSON conf}' > "$out/config.json"
|
||||
cp -R webapp $out
|
||||
cp ${jitsi-meet}/libs/external_api.min.js $out/jitsi_external_api.min.js
|
||||
echo "${version}" > "$out/version"
|
||||
jq -s '.[0] * $conf' "config.sample.json" --argjson "conf" '${builtins.toJSON noPhoningHome}' > "$out/config.json"
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
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";
|
||||
maintainers = lib.teams.matrix.members;
|
||||
license = lib.licenses.asl20;
|
||||
platforms = lib.platforms.all;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -4389,8 +4389,10 @@ with pkgs;
|
|||
NIXOS_OZONE_WL=1 exec ${element-desktop}/bin/element-desktop "$@"
|
||||
'';
|
||||
|
||||
element-web = callPackage ../applications/networking/instant-messengers/element/element-web.nix {
|
||||
conf = config.element-web.conf or {};
|
||||
element-web-unwrapped = callPackage ../applications/networking/instant-messengers/element/element-web.nix { };
|
||||
|
||||
element-web = callPackage ../applications/networking/instant-messengers/element/element-web-wrapper.nix {
|
||||
conf = config.element-web.conf or { };
|
||||
};
|
||||
|
||||
elementary-xfce-icon-theme = callPackage ../data/icons/elementary-xfce-icon-theme { };
|
||||
|
|
Loading…
Reference in a new issue