mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-30 19:02:57 +00:00
Merge pull request #132601 from petabyteboy/feature/seshat2
element-desktop: build native modules
This commit is contained in:
commit
1ad0542a78
@ -1,6 +1,7 @@
|
||||
{ lib, fetchFromGitHub
|
||||
, makeWrapper, makeDesktopItem, mkYarnPackage
|
||||
, electron, element-web
|
||||
, callPackage
|
||||
}:
|
||||
# Notes for maintainers:
|
||||
# * versions of `element-web` and `element-desktop` should be kept in sync.
|
||||
@ -24,6 +25,9 @@ in mkYarnPackage rec {
|
||||
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
|
||||
seshat = callPackage ./seshat {};
|
||||
keytar = callPackage ./keytar {};
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
export HOME=$(mktemp -d)
|
||||
@ -32,6 +36,9 @@ in mkYarnPackage rec {
|
||||
yarn run i18n
|
||||
node ./scripts/copy-res.js
|
||||
popd
|
||||
rm -rf node_modules/matrix-seshat node_modules/keytar
|
||||
ln -s $keytar node_modules/keytar
|
||||
ln -s $seshat node_modules/matrix-seshat
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
|
@ -0,0 +1,41 @@
|
||||
{ stdenv, fetchFromGitHub, nodejs-14_x, python3, callPackage, fixup_yarn_lock, yarn, pkg-config, libsecret }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "keytar";
|
||||
version = "7.7.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "atom";
|
||||
repo = "node-keytar";
|
||||
rev = "v${version}";
|
||||
sha256 = "0ajvr4kjbyw2shb1y14c0dsghdlnq30f19hk2sbzj6n9y3xa3pmi";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ nodejs-14_x python3 yarn pkg-config];
|
||||
buildInputs = [ libsecret ];
|
||||
|
||||
npm_config_nodedir = nodejs-14_x;
|
||||
|
||||
yarnOfflineCache = (callPackage ./yarn.nix {}).offline_cache;
|
||||
|
||||
buildPhase = ''
|
||||
cp ${./yarn.lock} ./yarn.lock
|
||||
chmod u+w . ./yarn.lock
|
||||
export HOME=/tmp
|
||||
yarn config --offline set yarn-offline-mirror ${yarnOfflineCache}
|
||||
${fixup_yarn_lock}/bin/fixup_yarn_lock yarn.lock
|
||||
yarn install --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive
|
||||
patchShebangs node_modules/
|
||||
node_modules/.bin/node-gyp rebuild
|
||||
'';
|
||||
|
||||
doCheck = false;
|
||||
|
||||
installPhase = ''
|
||||
shopt -s extglob
|
||||
rm -rf node_modules
|
||||
mkdir -p $out
|
||||
cp -r ./!(build) $out
|
||||
install -D -t $out/build/Release build/Release/keytar.node
|
||||
'';
|
||||
}
|
19
pkgs/applications/networking/instant-messengers/element/keytar/update.sh
Executable file
19
pkgs/applications/networking/instant-messengers/element/keytar/update.sh
Executable file
@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -I nixpkgs=../ -i bash -p wget yarn2nix yarn
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
if [ "$#" -ne 1 ] || [[ "$1" == -* ]]; then
|
||||
echo "Regenerates the Yarn dependency lock files."
|
||||
echo "Usage: $0 <git release tag>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SRC="https://raw.githubusercontent.com/atom/node-keytar/$1"
|
||||
|
||||
wget "$SRC/package-lock.json"
|
||||
wget "$SRC/package.json"
|
||||
rm -f yarn.lock
|
||||
yarn import
|
||||
yarn2nix > yarn.nix
|
||||
rm -rf node_modules package.json package-lock.json
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,44 @@
|
||||
{ rustPlatform, fetchFromGitHub, callPackage, sqlcipher, nodejs-14_x, python3, yarn, fixup_yarn_lock }:
|
||||
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "seshat-node";
|
||||
version = "2.3.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "matrix-org";
|
||||
repo = "seshat";
|
||||
rev = version;
|
||||
sha256 = "0zigrz59mhih9asmbbh38z2fg0sii2342q6q0500qil2a0rssai7";
|
||||
};
|
||||
|
||||
sourceRoot = "source/seshat-node/native";
|
||||
|
||||
nativeBuildInputs = [ nodejs-14_x python3 yarn ];
|
||||
buildInputs = [ sqlcipher ];
|
||||
|
||||
npm_config_nodedir = nodejs-14_x;
|
||||
|
||||
yarnOfflineCache = (callPackage ./yarn.nix {}).offline_cache;
|
||||
|
||||
buildPhase = ''
|
||||
cd ..
|
||||
chmod u+w . ./yarn.lock
|
||||
export HOME=/tmp
|
||||
yarn config --offline set yarn-offline-mirror ${yarnOfflineCache}
|
||||
${fixup_yarn_lock}/bin/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
|
||||
'';
|
||||
|
||||
doCheck = false;
|
||||
|
||||
installPhase = ''
|
||||
shopt -s extglob
|
||||
rm -rf native/!(index.node)
|
||||
rm -rf node_modules
|
||||
cp -r . $out
|
||||
'';
|
||||
|
||||
cargoSha256 = "0habjf85mzqxwf8k15msm4cavd7ldq4zpxddkwd4inl2lkvlffqj";
|
||||
}
|
16
pkgs/applications/networking/instant-messengers/element/seshat/update.sh
Executable file
16
pkgs/applications/networking/instant-messengers/element/seshat/update.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -I nixpkgs=../ -i bash -p wget yarn2nix
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
if [ "$#" -ne 1 ] || [[ "$1" == -* ]]; then
|
||||
echo "Regenerates the Yarn dependency lock files."
|
||||
echo "Usage: $0 <git release tag>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SRC="https://raw.githubusercontent.com/matrix-org/seshat/$1"
|
||||
|
||||
wget "$SRC/seshat-node/yarn.lock"
|
||||
yarn2nix > yarn.nix
|
||||
rm yarn.lock
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user