nixpkgs/pkgs/servers/monitoring/matrix-alertmanager/update.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

33 lines
998 B
Nix
Raw Normal View History

2021-09-04 14:18:09 +00:00
{ lib, writeShellScript
, coreutils, jq, common-updater-scripts
, curl, wget, gnugrep, yarn, prefetch-yarn-deps
}:
writeShellScript "update-matrix-alertmanager" ''
set -xe
export PATH="${lib.makeBinPath [ gnugrep coreutils curl wget jq common-updater-scripts yarn prefetch-yarn-deps ]}"
cd pkgs/servers/monitoring/matrix-alertmanager/
2021-09-04 14:18:09 +00:00
owner="jaywink"
repo="matrix-alertmanager"
version=`curl -s "https://api.github.com/repos/$owner/$repo/tags" | jq -r .[0].name | grep -oP "^v\K.*"`
url="https://raw.githubusercontent.com/$owner/$repo/v$version/"
(
cd ../../../..
2021-09-04 14:18:09 +00:00
update-source-version matrix-alertmanager "$version" --file=pkgs/servers/monitoring/matrix-alertmanager/default.nix
)
rm -f package.json package-lock.json yarn.lock
wget "$url/package.json" "$url/package-lock.json"
yarn import
echo $(prefetch-yarn-deps) > yarn-hash
jq '. + { bin: .main }' package.json > package.json.tmp
mv package.json{.tmp,}
rm -rf package-lock.json node_modules
''