element-{web,desktop}: 1.12.10 -> 1.12.14
This commit is contained in:
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"version" = "1.12.10";
|
||||
"hashes" = {
|
||||
"desktopSrcHash" = "sha256-2LQBT3+2JTR3XHO3DynOp8cw2m2SB/mGH01e3SFD/IM=";
|
||||
"desktopYarnHash" = "sha256-QIzuVKmUS4tqXAzhpfLZOp51kLbfC1M2nrff8e+sdg4=";
|
||||
};
|
||||
}
|
||||
@@ -5,16 +5,17 @@
|
||||
makeWrapper,
|
||||
makeDesktopItem,
|
||||
nodejs,
|
||||
electron_40,
|
||||
electron_41,
|
||||
element-web,
|
||||
sqlcipher,
|
||||
callPackage,
|
||||
typescript,
|
||||
tsx,
|
||||
sqlcipher,
|
||||
# command line arguments which are always set
|
||||
commandLineArgs ? "",
|
||||
yarnConfigHook,
|
||||
yarnBuildHook,
|
||||
fetchYarnDeps,
|
||||
fetchPnpmDeps,
|
||||
pnpmConfigHook,
|
||||
pnpm,
|
||||
asar,
|
||||
copyDesktopItems,
|
||||
darwin,
|
||||
@@ -22,166 +23,159 @@
|
||||
}:
|
||||
|
||||
let
|
||||
pinData = import ./element-desktop-pin.nix;
|
||||
inherit (pinData.hashes) desktopSrcHash desktopYarnHash;
|
||||
executableName = "element-desktop";
|
||||
electron = electron_40;
|
||||
electron = electron_41;
|
||||
seshat = callPackage ./seshat { };
|
||||
in
|
||||
stdenv.mkDerivation (
|
||||
finalAttrs:
|
||||
removeAttrs pinData [ "hashes" ]
|
||||
// {
|
||||
pname = "element-desktop";
|
||||
name = "${finalAttrs.pname}-${finalAttrs.version}";
|
||||
src = fetchFromGitHub {
|
||||
owner = "element-hq";
|
||||
repo = "element-desktop";
|
||||
rev = "v${finalAttrs.version}";
|
||||
hash = desktopSrcHash;
|
||||
};
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "element-desktop";
|
||||
version = "1.12.14";
|
||||
|
||||
offlineCache = fetchYarnDeps {
|
||||
yarnLock = finalAttrs.src + "/yarn.lock";
|
||||
hash = desktopYarnHash;
|
||||
};
|
||||
src = fetchFromGitHub {
|
||||
owner = "element-hq";
|
||||
repo = "element-web";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = "sha256-yy7CfMOMT1DBXHDHaDyAaOgp3s2KQIKA1A6zUhVOUhM=";
|
||||
};
|
||||
|
||||
env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
|
||||
pnpmDeps = fetchPnpmDeps {
|
||||
pname = "element";
|
||||
inherit (finalAttrs)
|
||||
version
|
||||
src
|
||||
;
|
||||
fetcherVersion = 3;
|
||||
hash = "sha256-0yqWObZtRntsH7gk+OB8pMuWsrvCQ4L9173Qv0o5abk=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
asar
|
||||
copyDesktopItems
|
||||
nodejs
|
||||
makeWrapper
|
||||
typescript
|
||||
yarnConfigHook
|
||||
yarnBuildHook
|
||||
]
|
||||
++ lib.optionals stdenv.hostPlatform.isDarwin [
|
||||
darwin.autoSignDarwinBinariesHook
|
||||
actool
|
||||
];
|
||||
env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
|
||||
|
||||
inherit seshat;
|
||||
nativeBuildInputs = [
|
||||
asar
|
||||
copyDesktopItems
|
||||
nodejs
|
||||
makeWrapper
|
||||
typescript
|
||||
pnpm
|
||||
pnpmConfigHook
|
||||
tsx
|
||||
]
|
||||
++ lib.optionals stdenv.hostPlatform.isDarwin [
|
||||
darwin.autoSignDarwinBinariesHook
|
||||
actool
|
||||
];
|
||||
|
||||
# Only affects unused scripts in $out/share/element/electron/scripts. Also
|
||||
# breaks because there are some `node`-scripts with a `npx`-shebang and
|
||||
# this shouldn't be in the closure just for unused scripts.
|
||||
dontPatchShebangs = true;
|
||||
inherit seshat;
|
||||
|
||||
postPatch = ''
|
||||
cp -r ${electron.dist} electron-dist
|
||||
chmod -R u+w electron-dist
|
||||
postPatch = ''
|
||||
cd apps/desktop
|
||||
|
||||
substituteInPlace package.json \
|
||||
--replace-fail \
|
||||
' electron-builder",' \
|
||||
' electron-builder --dir -c.electronDist=electron-dist -c.electronVersion=${electron.version} -c.mac.identity=null",'
|
||||
cp -r ${electron.dist} electron-dist
|
||||
chmod -R u+w electron-dist
|
||||
|
||||
# `@electron/fuses` tries to run `codesign` and fails. Disable and use autoSignDarwinBinariesHook instead
|
||||
substituteInPlace ./electron-builder.ts \
|
||||
--replace-fail "resetAdHocDarwinSignature:" "// resetAdHocDarwinSignature:"
|
||||
# `@electron/fuses` tries to run `codesign` and fails. Disable and use autoSignDarwinBinariesHook instead
|
||||
substituteInPlace ./electron-builder.ts \
|
||||
--replace-fail "resetAdHocDarwinSignature:" "// resetAdHocDarwinSignature:"
|
||||
|
||||
# Need to disable asar integrity check to copy in native seshat files, see postBuild phase
|
||||
substituteInPlace ./electron-builder.ts \
|
||||
--replace-fail "enableEmbeddedAsarIntegrityValidation: true" "enableEmbeddedAsarIntegrityValidation: false"
|
||||
'';
|
||||
# Need to disable asar integrity check to copy in native seshat files, see postBuild phase
|
||||
substituteInPlace ./electron-builder.ts \
|
||||
--replace-fail "enableEmbeddedAsarIntegrityValidation: true" "enableEmbeddedAsarIntegrityValidation: false"
|
||||
|
||||
preBuild = ''
|
||||
# Apply upstream patch
|
||||
# Can be removed if upstream removes patches/@types+auto-launch+5.0.5.patch introduced in
|
||||
# https://github.com/element-hq/element-desktop/commit/5e882f8e08d58bf9663c8e3ab33885bf7b3709de
|
||||
node ./node_modules/patch-package/index.js
|
||||
'';
|
||||
cd ../../
|
||||
'';
|
||||
|
||||
postBuild = ''
|
||||
# relative path to app.asar differs on Linux and MacOS
|
||||
packed=$(find ./dist -name app.asar)
|
||||
asar extract "$packed" tmp-app
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
# linking here leads to Error: tmp-app/node_modules/matrix-seshat: file ... links out of the package
|
||||
cp -r $seshat tmp-app/node_modules/matrix-seshat
|
||||
export VERSION=${finalAttrs.version}
|
||||
|
||||
asar pack tmp-app "$packed"
|
||||
'';
|
||||
pnpm -C apps/desktop run build:ts
|
||||
pnpm -C apps/desktop run build:res
|
||||
pnpm -C apps/desktop exec electron-builder --dir -c.electronDist=electron-dist -c.electronVersion=${electron.version} -c.mac.identity=null
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
''
|
||||
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
|
||||
mkdir -p "$out/Applications" "$out/bin"
|
||||
mv dist/mac*/Element.app "$out/Applications"
|
||||
cd apps/desktop
|
||||
|
||||
ln -s '${element-web}' "$out/Applications/Element.app/Contents/Resources/webapp"
|
||||
# relative path to app.asar differs on Linux and MacOS
|
||||
packed=$(find ./dist -name app.asar)
|
||||
asar extract "$packed" tmp-app
|
||||
|
||||
wrapProgram "$out/Applications/Element.app/Contents/MacOS/Element" \
|
||||
--add-flags ${lib.escapeShellArg commandLineArgs}
|
||||
# linking here leads to Error: tmp-app/node_modules/matrix-seshat: file ... links out of the package
|
||||
cp -r $seshat tmp-app/node_modules/matrix-seshat
|
||||
|
||||
makeWrapper "$out/Applications/Element.app/Contents/MacOS/Element" "$out/bin/${executableName}"
|
||||
''
|
||||
+ lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
|
||||
mkdir -p "$out/bin" "$out/share"
|
||||
asar pack tmp-app "$packed"
|
||||
|
||||
cp -a dist/*-unpacked/resources $out/share/element
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
ln -s '${element-web}' "$out/share/element/webapp"
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
''
|
||||
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
|
||||
mkdir -p "$out/Applications" "$out/bin"
|
||||
mv dist/mac*/Element.app "$out/Applications"
|
||||
|
||||
# icon, used in makeDesktopItem
|
||||
mkdir -p "$out/share/icons/hicolor/512x512/apps"
|
||||
ln -s "$out/share/element/build/icon.png" "$out/share/icons/hicolor/512x512/apps/element.png"
|
||||
ln -s '${element-web}' "$out/Applications/Element.app/Contents/Resources/webapp"
|
||||
|
||||
# executable wrapper
|
||||
# LD_PRELOAD workaround for sqlcipher not found: https://github.com/matrix-org/seshat/issues/102
|
||||
makeWrapper '${lib.getExe electron}' "$out/bin/${executableName}" \
|
||||
--set LD_PRELOAD ${sqlcipher}/lib/libsqlcipher.so \
|
||||
--add-flags "$out/share/element/app.asar" \
|
||||
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}" \
|
||||
--add-flags ${lib.escapeShellArg commandLineArgs}
|
||||
''
|
||||
+ ''
|
||||
runHook postInstall
|
||||
'';
|
||||
wrapProgram "$out/Applications/Element.app/Contents/MacOS/Element" \
|
||||
--add-flags ${lib.escapeShellArg commandLineArgs}
|
||||
|
||||
# The desktop item properties should be kept in sync with data from upstream:
|
||||
# https://github.com/element-hq/element-desktop/blob/develop/package.json
|
||||
desktopItems = [
|
||||
(makeDesktopItem {
|
||||
name = "element-desktop";
|
||||
exec = "${executableName} %u";
|
||||
icon = "element";
|
||||
desktopName = "Element";
|
||||
genericName = "Matrix Client";
|
||||
comment = finalAttrs.meta.description;
|
||||
categories = [
|
||||
"Network"
|
||||
"InstantMessaging"
|
||||
"Chat"
|
||||
];
|
||||
startupWMClass = "Element";
|
||||
mimeTypes = [
|
||||
"x-scheme-handler/element"
|
||||
"x-scheme-handler/io.element.desktop"
|
||||
];
|
||||
})
|
||||
];
|
||||
makeWrapper "$out/Applications/Element.app/Contents/MacOS/Element" "$out/bin/element-desktop"
|
||||
''
|
||||
+ lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
|
||||
mkdir -p "$out/bin" "$out/share"
|
||||
|
||||
stripDebugList = lib.optionals stdenv.hostPlatform.isDarwin [
|
||||
"Applications/Element.app/Contents/MacOS"
|
||||
];
|
||||
cp -a dist/*-unpacked/resources $out/share/element
|
||||
|
||||
passthru = {
|
||||
# run with: nix-shell ./maintainers/scripts/update.nix --argstr package element-desktop
|
||||
updateScript = ./update.sh;
|
||||
};
|
||||
ln -s '${element-web}' "$out/share/element/webapp"
|
||||
|
||||
meta = {
|
||||
description = "Feature-rich client for Matrix.org";
|
||||
homepage = "https://element.io/";
|
||||
changelog = "https://github.com/element-hq/element-desktop/blob/v${finalAttrs.version}/CHANGELOG.md";
|
||||
license = lib.licenses.agpl3Plus;
|
||||
teams = [ lib.teams.matrix ];
|
||||
inherit (electron.meta) platforms;
|
||||
mainProgram = "element-desktop";
|
||||
};
|
||||
}
|
||||
)
|
||||
# icon, used in makeDesktopItem
|
||||
mkdir -p "$out/share/icons/hicolor/512x512/apps"
|
||||
ln -s "$out/share/element/build/icon.png" "$out/share/icons/hicolor/512x512/apps/element.png"
|
||||
|
||||
# executable wrapper
|
||||
makeWrapper '${lib.getExe electron}' "$out/bin/element-desktop" \
|
||||
--add-flags "$out/share/element/app.asar" \
|
||||
--set LD_PRELOAD ${sqlcipher}/lib/libsqlcipher.so \
|
||||
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}" \
|
||||
--add-flags ${lib.escapeShellArg commandLineArgs}
|
||||
''
|
||||
+ ''
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
# The desktop item properties should be kept in sync with data from upstream:
|
||||
# https://github.com/element-hq/element-desktop/blob/develop/package.json
|
||||
desktopItems = [
|
||||
(makeDesktopItem {
|
||||
name = "element-desktop";
|
||||
exec = "element-desktop %u";
|
||||
icon = "element";
|
||||
desktopName = "Element";
|
||||
genericName = "Matrix Client";
|
||||
comment = finalAttrs.meta.description;
|
||||
categories = [
|
||||
"Network"
|
||||
"InstantMessaging"
|
||||
"Chat"
|
||||
];
|
||||
startupWMClass = "Element";
|
||||
mimeTypes = [
|
||||
"x-scheme-handler/element"
|
||||
"x-scheme-handler/io.element.desktop"
|
||||
];
|
||||
})
|
||||
];
|
||||
|
||||
stripDebugList = lib.optionals stdenv.hostPlatform.isDarwin [
|
||||
"Applications/Element.app/Contents/MacOS"
|
||||
];
|
||||
|
||||
meta = {
|
||||
description = "Feature-rich client for Matrix.org";
|
||||
homepage = "https://element.io/";
|
||||
changelog = "https://github.com/element-hq/element-web/blob/v${finalAttrs.version}/CHANGELOG.md";
|
||||
license = lib.licenses.agpl3Plus;
|
||||
teams = [ lib.teams.matrix ];
|
||||
inherit (electron.meta) platforms;
|
||||
mainProgram = "element-desktop";
|
||||
};
|
||||
})
|
||||
|
||||
@@ -1,72 +1,50 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
rustPlatform,
|
||||
fetchFromGitHub,
|
||||
sqlcipher,
|
||||
rustPlatform,
|
||||
nodejs,
|
||||
python3,
|
||||
yarn,
|
||||
fixup-yarn-lock,
|
||||
fetchYarnDeps,
|
||||
removeReferencesTo,
|
||||
yarnConfigHook,
|
||||
yarnBuildHook,
|
||||
sqlcipher,
|
||||
}:
|
||||
|
||||
let
|
||||
pinData = lib.importJSON ./pin.json;
|
||||
|
||||
in
|
||||
rustPlatform.buildRustPackage (finalAttrs: {
|
||||
pname = "seshat-node";
|
||||
inherit (pinData) version cargoHash;
|
||||
version = "4.0.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "matrix-org";
|
||||
repo = "seshat";
|
||||
rev = finalAttrs.version;
|
||||
hash = pinData.srcHash;
|
||||
tag = finalAttrs.version;
|
||||
hash = "sha256-2v/qXMCD+r+CSQHtP/YT62p4GoApbGz33kcZfJAKbOU=";
|
||||
};
|
||||
|
||||
sourceRoot = "${finalAttrs.src.name}/seshat-node/native";
|
||||
sourceRoot = "${finalAttrs.src.name}/seshat-node";
|
||||
|
||||
nativeBuildInputs = [
|
||||
nodejs
|
||||
python3
|
||||
yarn
|
||||
fixup-yarn-lock
|
||||
];
|
||||
buildInputs = [ sqlcipher ];
|
||||
|
||||
npm_config_nodedir = nodejs;
|
||||
cargoHash = "sha256-krSm1wy7HkCOLEHPPHCx6V9Mj+FiavyhO6bLOz2/3Qw=";
|
||||
|
||||
yarnOfflineCache = fetchYarnDeps {
|
||||
yarnLock = finalAttrs.src + "/seshat-node/yarn.lock";
|
||||
sha256 = pinData.yarnHash;
|
||||
hash = "sha256-hh9n8By/dNdKS55rcZkzCxmJWwQa6Ovt+4M3YP3/hDs=";
|
||||
};
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
cd ..
|
||||
chmod u+w . ./yarn.lock
|
||||
export HOME=$PWD/tmp
|
||||
mkdir -p $HOME
|
||||
yarn config --offline set yarn-offline-mirror $yarnOfflineCache
|
||||
fixup-yarn-lock yarn.lock
|
||||
yarn install --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive
|
||||
patchShebangs node_modules/
|
||||
node_modules/.bin/neon build --release -- --target ${stdenv.hostPlatform.rust.rustcTarget} -Z unstable-options --out-dir target/release
|
||||
runHook postBuild
|
||||
'';
|
||||
nativeBuildInputs = [
|
||||
nodejs
|
||||
yarn
|
||||
yarnConfigHook
|
||||
yarnBuildHook
|
||||
];
|
||||
|
||||
doCheck = false;
|
||||
buildInputs = [ sqlcipher ];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
shopt -s extglob
|
||||
rm -rf native/!(index.node)
|
||||
rm -rf node_modules $HOME
|
||||
cp -r . $out
|
||||
${removeReferencesTo}/bin/remove-references-to -t ${stdenv.cc.cc} $out/native/index.node
|
||||
|
||||
mkdir -p "$out"
|
||||
mv "index."{node,js} "$out"
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"version": "2.3.3",
|
||||
"srcHash": "sha256-HmKHWFoO8TQ9S/RcJnJ3h85/2uSkqGrgLnX82hkux4Q=",
|
||||
"yarnHash": "1cbkv8ap7f8vxl5brzqb86d2dyxg555sz67cldrp0vgnk8sq6ibp",
|
||||
"cargoHash": "sha256-klrFk0gpqQu/9MzLEYMNqEBETZMXtZJX67Sm5ZqyHfE=="
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -I nixpkgs=../../../../../../ -i bash -p wget prefetch-yarn-deps yarn nix-prefetch nix-prefetch-github
|
||||
|
||||
if [ "$#" -gt 1 ] || [[ "$1" == -* ]]; then
|
||||
echo "Regenerates packaging data for the seshat package."
|
||||
echo "Usage: $0 [git release tag]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
version="$1"
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
if [ -z "$version" ]; then
|
||||
version="$(wget -O- "https://api.github.com/repos/matrix-org/seshat/tags" | jq -r '.[] | .name' | sort --version-sort | tail -1)"
|
||||
fi
|
||||
|
||||
SRC="https://raw.githubusercontent.com/matrix-org/seshat/$version"
|
||||
|
||||
tmpdir=$(mktemp -d)
|
||||
trap 'rm -rf "$tmpdir"' EXIT
|
||||
|
||||
pushd $tmpdir
|
||||
wget "$SRC/seshat-node/yarn.lock"
|
||||
yarn_hash=$(prefetch-yarn-deps yarn.lock)
|
||||
popd
|
||||
|
||||
src_hash=$(nix-prefetch-github matrix-org seshat --rev ${version} | jq -r .hash)
|
||||
|
||||
cat > pin.json << EOF
|
||||
{
|
||||
"version": "$version",
|
||||
"srcHash": "$src_hash",
|
||||
"yarnHash": "$yarn_hash",
|
||||
"cargoHash": "0000000000000000000000000000000000000000000000000000"
|
||||
}
|
||||
EOF
|
||||
|
||||
cargo_hash=$(nix-prefetch "{ sha256 }: (import ../../../../../.. {}).element-desktop.seshat.cargoDeps")
|
||||
|
||||
cat > pin.json << EOF
|
||||
{
|
||||
"version": "$version",
|
||||
"srcHash": "$src_hash",
|
||||
"yarnHash": "$yarn_hash",
|
||||
"cargoHash": "$cargo_hash"
|
||||
}
|
||||
EOF
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p nix coreutils prefetch-yarn-deps jq curl
|
||||
|
||||
if [ "$#" -gt 1 ] || [[ "$1" == -* ]]; then
|
||||
echo "Regenerates packaging data for the element packages."
|
||||
echo "Usage: $0 [git release tag]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
version="$1"
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
if [ -z "$version" ]; then
|
||||
version="$(curl -fsSL "https://api.github.com/repos/element-hq/element-desktop/releases/latest" | jq -r '.tag_name')"
|
||||
fi
|
||||
|
||||
# strip leading "v"
|
||||
version="${version#v}"
|
||||
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")" || exit 1
|
||||
|
||||
nixflags=(
|
||||
--extra-experimental-features
|
||||
"nix-command flakes"
|
||||
)
|
||||
|
||||
# HACK: prefetch-yarn-deps hashes may output extra clutter on stdout (!) so
|
||||
# we'll need to get the last line, last word
|
||||
fixupHash() {
|
||||
local sorta_yarn_hash="$(tail -n1 <<< "$1")"
|
||||
local almost_yarn_hash="${sorta_yarn_hash##* }"
|
||||
local yarn_hash="$(nix "${nixflags[@]}" hash convert --hash-algo sha256 "$almost_yarn_hash")"
|
||||
|
||||
printf "%s" "$yarn_hash"
|
||||
}
|
||||
|
||||
getHashes() {
|
||||
variant="$1"
|
||||
output="$2"
|
||||
|
||||
local url="github:element-hq/element-$variant/v$version"
|
||||
local src="$(nix "${nixflags[@]}" flake prefetch --json "$url")"
|
||||
local src_hash="$(jq -r ".hash" <<< "$src")"
|
||||
local src_path="$(jq -r ".storePath" <<< "$src")"
|
||||
local yarn_hash="$(fixupHash "$(prefetch-yarn-deps "$src_path/yarn.lock")")"
|
||||
|
||||
cat > "$output" << EOF
|
||||
{
|
||||
"version" = "$version";
|
||||
"hashes" = {
|
||||
"${variant}SrcHash" = "$src_hash";
|
||||
"${variant}YarnHash" = "$yarn_hash";
|
||||
};
|
||||
}
|
||||
EOF
|
||||
|
||||
if [ "$variant" = "web" ]; then
|
||||
local shared_components_yarn_hash="$(fixupHash "$(prefetch-yarn-deps "$src_path/packages/shared-components/yarn.lock")")"
|
||||
sed -i "/^ \"webYarnHash/a \ \"webSharedComponentsYarnHash\" = \"$shared_components_yarn_hash\";" "$output"
|
||||
fi
|
||||
}
|
||||
|
||||
getHashes web ../element-web-unwrapped/element-web-pin.nix
|
||||
getHashes desktop element-desktop-pin.nix
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"version" = "1.12.10";
|
||||
"hashes" = {
|
||||
"webSrcHash" = "sha256-qc17AK2HvTJi0r03VTH0D2QitdYcGNRObji9cm6XsFU=";
|
||||
"webYarnHash" = "sha256-qdmdwjVXA+ZnNG3S9Pnm3JOrJXYXVdH+w7mccNjRmVM=";
|
||||
"webSharedComponentsYarnHash" = "sha256-0sOF3w6BnY1WenDP+zqZAo1W4C91glMQSMQ22iYajTw=";
|
||||
};
|
||||
}
|
||||
@@ -2,16 +2,16 @@
|
||||
lib,
|
||||
stdenv,
|
||||
fetchFromGitHub,
|
||||
fetchYarnDeps,
|
||||
jq,
|
||||
yarnConfigHook,
|
||||
nodejs,
|
||||
jitsi-meet,
|
||||
fetchPnpmDeps,
|
||||
pnpm,
|
||||
pnpmConfigHook,
|
||||
faketty,
|
||||
}:
|
||||
|
||||
let
|
||||
pinData = import ./element-web-pin.nix;
|
||||
inherit (pinData.hashes) webSrcHash webYarnHash webSharedComponentsYarnHash;
|
||||
noPhoningHome = {
|
||||
disable_guests = true; # disable automatic guest account registration at matrix.org
|
||||
};
|
||||
@@ -22,72 +22,62 @@ let
|
||||
meta = removeAttrs previousAttrs.meta [ "knownVulnerabilities" ];
|
||||
});
|
||||
in
|
||||
stdenv.mkDerivation (
|
||||
finalAttrs:
|
||||
removeAttrs pinData [ "hashes" ]
|
||||
// {
|
||||
pname = "element-web";
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "element-web";
|
||||
version = "1.12.14";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "element-hq";
|
||||
repo = "element-web";
|
||||
rev = "v${finalAttrs.version}";
|
||||
hash = webSrcHash;
|
||||
};
|
||||
src = fetchFromGitHub {
|
||||
owner = "element-hq";
|
||||
repo = "element-web";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = "sha256-yy7CfMOMT1DBXHDHaDyAaOgp3s2KQIKA1A6zUhVOUhM=";
|
||||
};
|
||||
|
||||
# https://github.com/element-hq/element-web/commit/e883b05206129857aa00ca726252e10a0eb05cf9
|
||||
# introduced a link: dependency that we need to fetch as well
|
||||
offlineCacheSharedComponents = fetchYarnDeps {
|
||||
yarnLock = finalAttrs.src + "/packages/shared-components/yarn.lock";
|
||||
sha256 = webSharedComponentsYarnHash;
|
||||
};
|
||||
pnpmDeps = fetchPnpmDeps {
|
||||
pname = "element";
|
||||
inherit (finalAttrs) version src;
|
||||
fetcherVersion = 3;
|
||||
hash = "sha256-0yqWObZtRntsH7gk+OB8pMuWsrvCQ4L9173Qv0o5abk=";
|
||||
};
|
||||
|
||||
offlineCache = fetchYarnDeps {
|
||||
yarnLock = finalAttrs.src + "/yarn.lock";
|
||||
sha256 = webYarnHash;
|
||||
};
|
||||
nativeBuildInputs = [
|
||||
jq
|
||||
nodejs
|
||||
pnpm
|
||||
pnpmConfigHook
|
||||
faketty
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
yarnConfigHook
|
||||
jq
|
||||
nodejs
|
||||
];
|
||||
# faketty is required to work around a bug in nx.
|
||||
# See: https://github.com/nrwl/nx/issues/22445
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
cd apps/web
|
||||
|
||||
export VERSION=${finalAttrs.version}
|
||||
export VERSION=${finalAttrs.version}
|
||||
faketty pnpm run build
|
||||
|
||||
pushd packages/shared-components
|
||||
yarnOfflineCache=${finalAttrs.offlineCacheSharedComponents} yarnConfigHook
|
||||
popd
|
||||
yarn --offline --cwd packages/shared-components prepare
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
yarn --offline build:res
|
||||
yarn --offline build:module_system
|
||||
yarn --offline build:bundle
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
cp -R webapp $out
|
||||
cp ${jitsi-meet-override}/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"
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
cp -R webapp $out
|
||||
cp ${jitsi-meet-override}/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";
|
||||
teams = [ lib.teams.matrix ];
|
||||
license = lib.licenses.agpl3Plus;
|
||||
platforms = lib.platforms.all;
|
||||
};
|
||||
}
|
||||
)
|
||||
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";
|
||||
teams = [ lib.teams.matrix ];
|
||||
license = lib.licenses.agpl3Plus;
|
||||
platforms = lib.platforms.all;
|
||||
};
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user