meshcentral: use fetchYarnDeps

This commit is contained in:
Robert Schütz 2023-09-05 21:58:39 -07:00
parent c9bf6dd5f0
commit b11afc4cbd
3 changed files with 18 additions and 11385 deletions

View File

@ -1,4 +1,10 @@
{ lib, fetchzip, yarn2nix-moretea, nodejs_18, dos2unix }:
{ lib
, fetchzip
, fetchYarnDeps
, yarn2nix-moretea
, nodejs_18
, dos2unix
}:
yarn2nix-moretea.mkYarnPackage {
version = "1.1.6";
@ -12,7 +18,11 @@ yarn2nix-moretea.mkYarnPackage {
packageJSON = ./package.json;
yarnLock = ./yarn.lock;
yarnNix = ./yarn.nix;
offlineCache = fetchYarnDeps {
yarnLock = ./yarn.lock;
hash = "sha256-aKWa6pvIi2JkOtpiWH19KZoncPuSIgvDk/j7PvXp2nw=";
};
# Tarball has CRLF line endings. This makes patching difficult, so let's convert them.
nativeBuildInputs = [ dos2unix ];

View File

@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
#! nix-shell -i bash -p nodejs yarn yarn2nix jq rsync common-updater-scripts moreutils
#! nix-shell -i bash -p nodejs yarn prefetch-yarn-deps jq rsync common-updater-scripts moreutils
set -exuo pipefail
@ -40,11 +40,15 @@ yarn install --ignore-scripts
cp package.json "$expr_dir"
cp yarn.lock "$expr_dir/yarn.lock"
yarn2nix > "$expr_dir/yarn.nix"
cd "$expr_dir/../../../.."
update-source-version meshcentral "$version" "$hash" "$tarball"
new_yarn_hash=$(prefetch-yarn-deps "$expr_dir/yarn.lock")
new_yarn_hash=$(nix-hash --type sha256 --to-sri "$new_yarn_hash")
old_yarn_hash=$(nix-instantiate --eval -A meshcentral.offlineCache.outputHash | tr -d '"')
sed -i "$expr_dir/default.nix" -re "s|\"$old_yarn_hash\"|\"$new_yarn_hash\"|"
# Only clean up if everything worked
cd /
rm -rf "$tmp"

File diff suppressed because it is too large Load Diff