element-desktop: 1.11.87 -> 1.11.89, element-{web,desktop}: move to pkgs/by-name, format (#365951)

This commit is contained in:
Austin Horstman
2024-12-20 22:50:07 -06:00
committed by GitHub
16 changed files with 131 additions and 127 deletions
@@ -1,85 +0,0 @@
{ lib
, stdenv
, fetchFromGitHub
, fetchYarnDeps
, jq
, yarn
, fixup-yarn-lock
, nodejs
, jitsi-meet
}:
let
pinData = import ./pin.nix;
inherit (pinData.hashes) webSrcHash webYarnHash;
noPhoningHome = {
disable_guests = true; # disable automatic guest account registration at matrix.org
};
in
stdenv.mkDerivation (finalAttrs: builtins.removeAttrs pinData [ "hashes" ] // {
pname = "element-web";
src = fetchFromGitHub {
owner = "element-hq";
repo = "element-web";
rev = "v${finalAttrs.version}";
hash = webSrcHash;
};
offlineCache = fetchYarnDeps {
yarnLock = finalAttrs.src + "/yarn.lock";
sha256 = webYarnHash;
};
nativeBuildInputs = [ yarn fixup-yarn-lock jq nodejs ];
buildPhase = ''
runHook preBuild
export VERSION=${finalAttrs.version}
yarn --offline build:res
yarn --offline build:module_system
yarn --offline build:bundle
runHook postBuild
'';
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/element-hq/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
'';
installPhase = ''
runHook preInstall
cp -R webapp $out
tar --extract --to-stdout --file ${jitsi-meet.src} jitsi-meet/libs/external_api.min.js > $out/jitsi_external_api.min.js
echo "${finalAttrs.version}" > "$out/version"
jq -s '.[0] * $conf' "config.sample.json" --argjson "conf" '${builtins.toJSON noPhoningHome}' > "$out/config.json"
runHook postInstall
'';
meta = {
description = "Glossy Matrix collaboration client for the web";
homepage = "https://element.io/";
changelog = "https://github.com/element-hq/element-web/blob/v${finalAttrs.version}/CHANGELOG.md";
maintainers = lib.teams.matrix.members;
license = lib.licenses.asl20;
platforms = lib.platforms.all;
};
})
@@ -1,9 +0,0 @@
{
"version" = "1.11.87";
"hashes" = {
"desktopSrcHash" = "sha256-rIxuXMHQVJrbfWibpiIBmTkXKHrBqnTMiBYIP8VOIH4=";
"desktopYarnHash" = "05qs1an3mbqsfn1nmgwagp564lqvyrbkyj58z5h2cbczqbavnxxz";
"webSrcHash" = "sha256-FcXYwYCx//fqWuUKRqTTntlT7jVBD1Heayg4T7ACHmc=";
"webYarnHash" = "0anamnfm5g4nj7wp18byi49x38aia490qfard2d34myzjgiby8v3";
};
}
@@ -0,0 +1,7 @@
{
"version" = "1.11.89";
"hashes" = {
"desktopSrcHash" = "sha256-vZLM1AIMxDltB+GeQEcYifnaBC1+4wWkotPFuelHxT0=";
"desktopYarnHash" = "1n057ic4dzcyg3wfr8jj7vab00jg2d1m38y5zk1kab1pka163f1q";
};
}
@@ -8,8 +8,6 @@
pkg-config,
libsecret,
xcbuild,
Security,
AppKit,
fetchNpmDeps,
npmHooks,
}:
@@ -36,12 +34,7 @@ stdenv.mkDerivation rec {
npmHooks.npmConfigHook
] ++ lib.optional stdenv.hostPlatform.isDarwin xcbuild;
buildInputs =
lib.optionals (!stdenv.hostPlatform.isDarwin) [ libsecret ]
++ lib.optionals stdenv.hostPlatform.isDarwin [
Security
AppKit
];
buildInputs = lib.optionals (!stdenv.hostPlatform.isDarwin) [ libsecret ];
npmDeps = fetchNpmDeps {
inherit src;
@@ -13,9 +13,6 @@
element-web,
sqlcipher,
callPackage,
Security,
AppKit,
CoreServices,
desktopToDarwinBundle,
useKeytar ? true,
# command line arguments which are always set
@@ -23,11 +20,11 @@
}:
let
pinData = import ./pin.nix;
pinData = import ./element-desktop-pin.nix;
inherit (pinData.hashes) desktopSrcHash desktopYarnHash;
executableName = "element-desktop";
keytar = callPackage ./keytar { inherit Security AppKit; };
seshat = callPackage ./seshat { inherit CoreServices; };
keytar = callPackage ./keytar { };
seshat = callPackage ./seshat { };
electron = electron_33;
in
stdenv.mkDerivation (
@@ -146,6 +143,7 @@ stdenv.mkDerivation (
'';
passthru = {
# run with: nix-shell ./maintainers/scripts/update.nix --argstr package element-desktop
updateScript = ./update.sh;
# TL;DR: keytar is optional while seshat isn't.
@@ -3,13 +3,11 @@
stdenv,
rustPlatform,
fetchFromGitHub,
rust,
sqlcipher,
nodejs,
python3,
yarn,
fixup-yarn-lock,
CoreServices,
fetchYarnDeps,
removeReferencesTo,
}:
@@ -37,7 +35,7 @@ rustPlatform.buildRustPackage rec {
yarn
fixup-yarn-lock
];
buildInputs = [ sqlcipher ] ++ lib.optional stdenv.hostPlatform.isDarwin CoreServices;
buildInputs = [ sqlcipher ];
npm_config_nodedir = nodejs;
@@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
#!nix-shell -I nixpkgs=../../../../../ -i bash -p nix wget prefetch-yarn-deps nix-prefetch-github jq
#!nix-shell -i bash -p nix wget prefetch-yarn-deps nix-prefetch-github jq
if [ "$#" -gt 1 ] || [[ "$1" == -* ]]; then
echo "Regenerates packaging data for the element packages."
@@ -22,6 +22,8 @@ version="${version#v}"
web_src="https://raw.githubusercontent.com/element-hq/element-web/v$version"
web_src_hash=$(nix-prefetch-github element-hq element-web --rev v${version} | jq -r .hash)
cd "$(dirname "${BASH_SOURCE[0]}")" || exit 1
web_tmpdir=$(mktemp -d)
trap 'rm -rf "$web_tmpdir"' EXIT
@@ -42,14 +44,22 @@ wget -q "$desktop_src/yarn.lock"
desktop_yarn_hash=$(prefetch-yarn-deps yarn.lock)
popd
cat > pin.nix << EOF
cat > ../element-web-unwrapped/element-web-pin.nix << EOF
{
"version" = "$version";
"hashes" = {
"desktopSrcHash" = "$desktop_src_hash";
"desktopYarnHash" = "$desktop_yarn_hash";
"webSrcHash" = "$web_src_hash";
"webYarnHash" = "$web_yarn_hash";
};
}
EOF
cat > element-desktop-pin.nix << EOF
{
"version" = "$version";
"hashes" = {
"desktopSrcHash" = "$desktop_src_hash";
"desktopYarnHash" = "$desktop_yarn_hash";
};
}
EOF
@@ -0,0 +1,7 @@
{
"version" = "1.11.89";
"hashes" = {
"webSrcHash" = "sha256-K9i5MxTJaX359qsnpfXZBZiNHbhCEy25plUPVUtbGQs=";
"webYarnHash" = "164smvrq9937x0pql20zdqab5w35fcidbywkzlyc5g4w7iwkd9kx";
};
}
@@ -0,0 +1,95 @@
{
lib,
stdenv,
fetchFromGitHub,
fetchYarnDeps,
jq,
yarn,
fixup-yarn-lock,
nodejs,
jitsi-meet,
}:
let
pinData = import ./element-web-pin.nix;
inherit (pinData.hashes) webSrcHash webYarnHash;
noPhoningHome = {
disable_guests = true; # disable automatic guest account registration at matrix.org
};
in
stdenv.mkDerivation (
finalAttrs:
builtins.removeAttrs pinData [ "hashes" ]
// {
pname = "element-web";
src = fetchFromGitHub {
owner = "element-hq";
repo = "element-web";
rev = "v${finalAttrs.version}";
hash = webSrcHash;
};
offlineCache = fetchYarnDeps {
yarnLock = finalAttrs.src + "/yarn.lock";
sha256 = webYarnHash;
};
nativeBuildInputs = [
yarn
fixup-yarn-lock
jq
nodejs
];
buildPhase = ''
runHook preBuild
export VERSION=${finalAttrs.version}
yarn --offline build:res
yarn --offline build:module_system
yarn --offline build:bundle
runHook postBuild
'';
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/element-hq/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
'';
installPhase = ''
runHook preInstall
cp -R webapp $out
tar --extract --to-stdout --file ${jitsi-meet.src} jitsi-meet/libs/external_api.min.js > $out/jitsi_external_api.min.js
echo "${finalAttrs.version}" > "$out/version"
jq -s '.[0] * $conf' "config.sample.json" --argjson "conf" '${builtins.toJSON noPhoningHome}' > "$out/config.json"
runHook postInstall
'';
meta = {
description = "Glossy Matrix collaboration client for the web";
homepage = "https://element.io/";
changelog = "https://github.com/element-hq/element-web/blob/v${finalAttrs.version}/CHANGELOG.md";
maintainers = lib.teams.matrix.members;
license = lib.licenses.asl20;
platforms = lib.platforms.all;
};
}
)
+1 -1
View File
@@ -322,7 +322,7 @@ mapAliases {
edUnstable = throw "edUnstable was removed; use ed instead"; # Added 2024-07-01
elasticsearch7Plugins = elasticsearchPlugins;
# Electron
element-desktop-wayland = throw "element-desktop-wayland has been removed. Consider setting NIXOS_OZONE_WL=1 via 'environment.sessionVariables' instead"; # Added 2024-12-17
elixir_ls = elixir-ls; # Added 2023-03-20
+1 -11
View File
@@ -2283,17 +2283,7 @@ with pkgs;
electronplayer = callPackage ../applications/video/electronplayer/electronplayer.nix { };
element-desktop = callPackage ../applications/networking/instant-messengers/element/element-desktop.nix {
inherit (darwin.apple_sdk.frameworks) Security AppKit CoreServices;
};
element-desktop-wayland = writeScriptBin "element-desktop" ''
#!/bin/sh
NIXOS_OZONE_WL=1 exec ${element-desktop}/bin/element-desktop "$@"
'';
element-web-unwrapped = callPackage ../applications/networking/instant-messengers/element/element-web.nix { };
element-web = callPackage ../applications/networking/instant-messengers/element/element-web-wrapper.nix {
element-web = callPackage ../by-name/el/element-web/package.nix {
conf = config.element-web.conf or { };
};