hedgedoc: use fetchYarnDeps, add update script

conduit-nginx
Yureka 2021-10-13 00:45:01 +02:00 committed by Yuka
parent fcec99feec
commit 149fb9c529
4 changed files with 50 additions and 12593 deletions

View File

@ -6,12 +6,15 @@
, which
, nodejs
, mkYarnPackage
, fetchYarnDeps
, python2
, nixosTests
, buildGoModule
}:
let
pinData = (builtins.fromJSON (builtins.readFile ./pin.json));
# we need a different version than the one already available in nixpkgs
esbuild-hedgedoc = buildGoModule rec {
pname = "esbuild";
@ -30,19 +33,22 @@ in
mkYarnPackage rec {
pname = "hedgedoc";
version = "1.9.0";
inherit (pinData) version;
src = fetchFromGitHub {
owner = "hedgedoc";
repo = "hedgedoc";
rev = version;
sha256 = "sha256-hSKQGkI1+68Zf05RhgRKZo47buyobzjhURSZ30/h0PA=";
sha256 = pinData.srcHash;
};
nativeBuildInputs = [ which makeWrapper ];
extraBuildInputs = [ python2 esbuild-hedgedoc ];
yarnNix = ./yarn.nix;
offlineCache = fetchYarnDeps {
inherit yarnLock;
sha256 = pinData.yarnHash;
};
# FIXME(@Ma27) on the bump to 1.9.0 I had to patch this file manually:
# I replaced `midi "https://github.com/paulrosen/MIDI.js.git#abcjs"` with
@ -101,7 +107,10 @@ mkYarnPackage rec {
runHook postDist
'';
passthru.tests = { inherit (nixosTests) hedgedoc; };
passthru = {
updateScript = ./update.sh;
tests = { inherit (nixosTests) hedgedoc; };
};
meta = with lib; {
description = "Realtime collaborative markdown notes on all platforms";

View File

@ -0,0 +1,5 @@
{
"version": "1.9.0",
"srcHash": "hSKQGkI1+68Zf05RhgRKZo47buyobzjhURSZ30/h0PA=",
"yarnHash": "0v51jmmbg8fx66ay2glby0gxw07in95igz325p42g5hjd5kankf6"
}

View File

@ -0,0 +1,32 @@
#!/usr/bin/env nix-shell
#!nix-shell -I nixpkgs=../../../../ -i bash -p nix wget prefetch-yarn-deps nix-prefetch-github
if [ "$#" -gt 1 ] || [[ "$1" == -* ]]; then
echo "Regenerates packaging data for the element packages."
echo "Usage: $0 [git release tag]"
exit 1
fi
version="$1"
set -euo pipefail
if [ -z "$version" ]; then
version="$(wget -O- "https://api.github.com/repos/hedgedoc/hedgedoc/releases?per_page=1" | jq -r '.[0].tag_name')"
fi
src="https://raw.githubusercontent.com/hedgedoc/hedgedoc/$version"
wget "$src/package.json" -O package.json
wget "$src/yarn.lock" -O yarn.lock
sed 's;midi "https://github\.com/paulrosen/MIDI\.js\.git;midi "git+https://github.com/paulrosen/MIDI.js.git;g' -i yarn.lock
src_hash=$(nix-prefetch-github hedgedoc hedgedoc --rev ${version} | jq -r .sha256)
yarn_hash=$(prefetch-yarn-deps yarn.lock)
cat > pin.json << EOF
{
"version": "$version",
"srcHash": "$src_hash",
"yarnHash": "$yarn_hash"
}
EOF

File diff suppressed because it is too large Load Diff