Merge pull request #254304 from dotlambda/meshcentral-fetchYarnDeps

meshcentral: use fetchYarnDeps
This commit is contained in:
Robert Schütz 2023-09-15 17:23:26 +00:00 committed by GitHub
commit 9eaa0e3995
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 11386 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 ];
@ -34,7 +44,7 @@ yarn2nix-moretea.mkYarnPackage {
meta = with lib; {
description = "Computer management web app";
homepage = "https://meshcentral.com/info/";
homepage = "https://meshcentral.com/";
maintainers = [ maintainers.lheckemann ];
license = licenses.asl20;
};

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