diff options
author | Nick Cao <nickcao@nichi.co> | 2023-01-13 11:28:42 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-13 11:28:42 +0800 |
commit | 7a79aed149de96446fcbb214d558bb62e33b8413 (patch) | |
tree | c291eeb16739f9ccb9796a25a7444f05c8b1cc17 /pkgs/applications/networking/instant-messengers/element | |
parent | d54b20402b780fc1f1e2f06df32dcdcea8da0c6c (diff) | |
parent | 88527c2e3175f10337ac2cefda6a3737c44daa46 (diff) | |
download | nixpkgs-7a79aed149de96446fcbb214d558bb62e33b8413.tar nixpkgs-7a79aed149de96446fcbb214d558bb62e33b8413.tar.gz nixpkgs-7a79aed149de96446fcbb214d558bb62e33b8413.tar.bz2 nixpkgs-7a79aed149de96446fcbb214d558bb62e33b8413.tar.lz nixpkgs-7a79aed149de96446fcbb214d558bb62e33b8413.tar.xz nixpkgs-7a79aed149de96446fcbb214d558bb62e33b8413.tar.zst nixpkgs-7a79aed149de96446fcbb214d558bb62e33b8413.zip |
Merge pull request #200336 from linsui/element-23b
element-web: export unwrapped
Diffstat (limited to 'pkgs/applications/networking/instant-messengers/element')
-rw-r--r-- | pkgs/applications/networking/instant-messengers/element/element-web-wrapper.nix | 26 | ||||
-rw-r--r-- | pkgs/applications/networking/instant-messengers/element/element-web.nix | 126 |
2 files changed, 78 insertions, 74 deletions
diff --git a/pkgs/applications/networking/instant-messengers/element/element-web-wrapper.nix b/pkgs/applications/networking/instant-messengers/element/element-web-wrapper.nix new file mode 100644 index 00000000000..c9a143ecb49 --- /dev/null +++ b/pkgs/applications/networking/instant-messengers/element/element-web-wrapper.nix @@ -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 + ''; +} diff --git a/pkgs/applications/networking/instant-messengers/element/element-web.nix b/pkgs/applications/networking/instant-messengers/element/element-web.nix index 6af1c2ec738..b73fda72174 100644 --- a/pkgs/applications/networking/instant-messengers/element/element-web.nix +++ b/pkgs/applications/networking/instant-messengers/element/element-web.nix @@ -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 }; +in +stdenv.mkDerivation rec { + pname = "element-web"; + inherit (pinData) version; + + src = fetchFromGitHub { + owner = "vector-im"; + repo = pname; + rev = "v${version}"; + sha256 = pinData.webSrcHash; + }; - 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 + offlineCache = fetchYarnDeps { + yarnLock = src + "/yarn.lock"; + sha256 = pinData.webYarnHash; + }; - export VERSION=${version} - yarn build:res --offline - yarn build:module_system --offline - yarn build:bundle --offline + nativeBuildInputs = [ yarn fixup_yarn_lock jq nodejs ]; - runHook postBuild - ''; + configurePhase = '' + runHook preConfigure - installPhase = '' - runHook preInstall + 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 - 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" + 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 postInstall - ''; + runHook postConfigure + ''; - 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; + buildPhase = '' + runHook preBuild - dontUnpack = true; + export VERSION=${version} + yarn build:res --offline + yarn build:module_system --offline + yarn build:bundle --offline - nativeBuildInputs = [ jq ]; + 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; + }; } |