1
0

feat: element

This commit is contained in:
2026-03-01 15:38:40 +01:00
parent b6386b6094
commit 1f342308de
7 changed files with 323 additions and 3 deletions
+74
View File
@@ -0,0 +1,74 @@
{
lib,
stdenv,
rustPlatform,
fetchFromGitHub,
sqlcipher,
nodejs,
python3,
yarn,
fixup-yarn-lock,
fetchYarnDeps,
removeReferencesTo,
}:
let
pinData = lib.importJSON ./pin.json;
in
rustPlatform.buildRustPackage rec {
pname = "seshat-node";
inherit (pinData) version cargoHash;
src = fetchFromGitHub {
owner = "matrix-org";
repo = "seshat";
rev = version;
hash = pinData.srcHash;
};
sourceRoot = "${src.name}/seshat-node/native";
nativeBuildInputs = [
nodejs
python3
yarn
fixup-yarn-lock
];
buildInputs = [ sqlcipher ];
npm_config_nodedir = nodejs;
yarnOfflineCache = fetchYarnDeps {
yarnLock = src + "/seshat-node/yarn.lock";
sha256 = pinData.yarnHash;
};
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
'';
doCheck = false;
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
runHook postInstall
'';
disallowedReferences = [ stdenv.cc.cc ];
}
+6
View File
@@ -0,0 +1,6 @@
{
"version": "2.3.3",
"srcHash": "sha256-HmKHWFoO8TQ9S/RcJnJ3h85/2uSkqGrgLnX82hkux4Q=",
"yarnHash": "1cbkv8ap7f8vxl5brzqb86d2dyxg555sz67cldrp0vgnk8sq6ibp",
"cargoHash": "sha256-klrFk0gpqQu/9MzLEYMNqEBETZMXtZJX67Sm5ZqyHfE=="
}
+49
View File
@@ -0,0 +1,49 @@
#!/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