element-desktop.keytar: 7.7.0 -> 7.9.0, switch to fetchNpmDeps

This commit is contained in:
Yureka 2023-02-01 22:28:04 +01:00
parent 5373f99ace
commit 01b0b7989c
4 changed files with 15 additions and 2561 deletions

View file

@ -1,5 +1,5 @@
{ lib, stdenv, fetchFromGitHub, nodejs, python3, callPackage, removeReferencesTo
, fixup_yarn_lock, yarn, pkg-config, libsecret, xcbuild, Security, AppKit, fetchYarnDeps }:
, pkg-config, libsecret, xcbuild, Security, AppKit, fetchNpmDeps, npmHooks }:
let
pinData = lib.importJSON ./pin.json;
@ -15,39 +15,26 @@ in stdenv.mkDerivation rec {
sha256 = pinData.srcHash;
};
nativeBuildInputs = [ nodejs python3 yarn pkg-config ]
nativeBuildInputs = [
nodejs python3 pkg-config
npmHooks.npmConfigHook
]
++ lib.optional stdenv.isDarwin xcbuild;
buildInputs = lib.optionals (!stdenv.isDarwin) [ libsecret ]
++ lib.optionals stdenv.isDarwin [ Security AppKit ];
npm_config_nodedir = nodejs;
yarnOfflineCache = fetchYarnDeps {
yarnLock = ./yarn.lock;
sha256 = pinData.yarnHash;
npmDeps = fetchNpmDeps {
inherit src;
hash = pinData.npmHash;
};
buildPhase = ''
runHook preBuild
cp ${./yarn.lock} ./yarn.lock
chmod u+w . ./yarn.lock
export HOME=$PWD/tmp
mkdir -p $HOME
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
runHook postBuild
'';
doCheck = false;
installPhase = ''
runHook preInstall
shopt -s extglob
rm -rf node_modules
rm -rf $HOME
mkdir -p $out
cp -r ./!(build) $out
install -D -t $out/build/Release build/Release/keytar.node

View file

@ -1,5 +1,5 @@
{
"version": "7.7.0",
"srcHash": "sd6h+vDJGvmXFhOm4MDAljb4dAOMBB8W1IL7JSfJWyo=",
"yarnHash": "1m75hvl06mcj260hicbmv75p94h73gw5d24zpm5wxwc0q8v8wzfl"
"version": "7.9.0",
"srcHash": "Mnl0Im2hZJXJEtyXb5rgMntekkUAnOG2MN1bwfgh0eg=",
"npmHash": "sha256-ldfRWV+HXBdBYO2ZiGbVFSHV4/bMG43U7w+sJ4kpVUY="
}

View file

@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
#!nix-shell -I nixpkgs=../../../../../../ -i bash -p wget prefetch-yarn-deps yarn
#!nix-shell -I nixpkgs=../../../../../../ -i bash -p wget prefetch-npm-deps
if [ "$#" -gt 1 ] || [[ "$1" == -* ]]; then
echo "Regenerates packaging data for the keytar package."
@ -22,10 +22,8 @@ SRC="https://raw.githubusercontent.com/atom/node-keytar/v$version"
wget "$SRC/package-lock.json"
wget "$SRC/package.json"
rm -f yarn.lock
yarn import
npm_hash=$(prefetch-npm-deps package-lock.json)
rm -rf node_modules package.json package-lock.json
yarn_hash=$(prefetch-yarn-deps yarn.lock)
src_hash=$(nix-prefetch-github atom node-keytar --rev v${version} | jq -r .sha256)
@ -33,6 +31,6 @@ cat > pin.json << EOF
{
"version": "$version",
"srcHash": "$src_hash",
"yarnHash": "$yarn_hash"
"npmHash": "$npm_hash"
}
EOF