element-desktop.keytar: use fetchYarnDeps
This commit is contained in:
parent
0f59dba39f
commit
9c36092389
4 changed files with 43 additions and 2882 deletions
|
@ -1,15 +1,18 @@
|
|||
{ lib, stdenv, fetchFromGitHub, nodejs-14_x, python3, callPackage
|
||||
, fixup_yarn_lock, yarn, pkg-config, libsecret, xcbuild, Security, AppKit }:
|
||||
, fixup_yarn_lock, yarn, pkg-config, libsecret, xcbuild, Security, AppKit, fetchYarnDeps }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
let
|
||||
pinData = (builtins.fromJSON (builtins.readFile ./pin.json));
|
||||
|
||||
in stdenv.mkDerivation rec {
|
||||
pname = "keytar";
|
||||
version = "7.7.0";
|
||||
inherit (pinData) version;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "atom";
|
||||
repo = "node-keytar";
|
||||
rev = "v${version}";
|
||||
sha256 = "0ajvr4kjbyw2shb1y14c0dsghdlnq30f19hk2sbzj6n9y3xa3pmi";
|
||||
sha256 = pinData.srcHash;
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ nodejs-14_x python3 yarn pkg-config ]
|
||||
|
@ -19,7 +22,10 @@ stdenv.mkDerivation rec {
|
|||
|
||||
npm_config_nodedir = nodejs-14_x;
|
||||
|
||||
yarnOfflineCache = (callPackage ./yarn.nix {}).offline_cache;
|
||||
yarnOfflineCache = fetchYarnDeps {
|
||||
yarnLock = ./yarn.lock;
|
||||
sha256 = pinData.yarnHash;
|
||||
};
|
||||
|
||||
buildPhase = ''
|
||||
cp ${./yarn.lock} ./yarn.lock
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"version": "7.7.0",
|
||||
"srcHash": "sd6h+vDJGvmXFhOm4MDAljb4dAOMBB8W1IL7JSfJWyo=",
|
||||
"yarnHash": "1m75hvl06mcj260hicbmv75p94h73gw5d24zpm5wxwc0q8v8wzfl"
|
||||
}
|
|
@ -1,19 +1,38 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -I nixpkgs=../ -i bash -p wget yarn2nix yarn
|
||||
#!nix-shell -I nixpkgs=../../../../../../ -i bash -p wget prefetch-yarn-deps yarn
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
if [ "$#" -ne 1 ] || [[ "$1" == -* ]]; then
|
||||
echo "Regenerates the Yarn dependency lock files."
|
||||
echo "Usage: $0 <git release tag>"
|
||||
if [ "$#" -gt 1 ] || [[ "$1" == -* ]]; then
|
||||
echo "Regenerates packaging data for the seshat package."
|
||||
echo "Usage: $0 [git release tag]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SRC="https://raw.githubusercontent.com/atom/node-keytar/$1"
|
||||
version="$1"
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
if [ -z "$version" ]; then
|
||||
version="$(wget -O- "https://api.github.com/repos/atom/node-keytar/releases?per_page=1" | jq -r '.[0].tag_name')"
|
||||
fi
|
||||
|
||||
# strip leading "v"
|
||||
version="${version#v}"
|
||||
|
||||
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
|
||||
yarn2nix > yarn.nix
|
||||
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)
|
||||
|
||||
cat > pin.json << EOF
|
||||
{
|
||||
"version": "$version",
|
||||
"srcHash": "$src_hash",
|
||||
"yarnHash": "$yarn_hash"
|
||||
}
|
||||
EOF
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue