mirror of
https://github.com/SebastianWendel/nixpkgs.git
synced 2024-09-21 04:49:01 +02:00
touchosc: add updateScript
This commit is contained in:
parent
d2cfe468f8
commit
9ae845e3bf
|
@ -96,6 +96,8 @@ stdenv.mkDerivation rec {
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
passthru.updateScript = ./update.sh;
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
homepage = "https://hexler.net/touchosc";
|
homepage = "https://hexler.net/touchosc";
|
||||||
description = "Next generation modular control surface";
|
description = "Next generation modular control surface";
|
||||||
|
|
33
pkgs/applications/audio/touchosc/update.sh
Executable file
33
pkgs/applications/audio/touchosc/update.sh
Executable file
|
@ -0,0 +1,33 @@
|
||||||
|
#!/usr/bin/env nix-shell
|
||||||
|
#!nix-shell -i bash -p nix curl libxml2 jq common-updater-scripts
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
nixpkgs="$(git rev-parse --show-toplevel || (printf 'Could not find root of nixpkgs repo\nAre we running from within the nixpkgs git repo?\n' >&2; exit 1))"
|
||||||
|
|
||||||
|
attr="${UPDATE_NIX_ATTR_PATH:-touchosc}"
|
||||||
|
version="$(curl -sSL https://hexler.net/touchosc/appcast/linux | xmllint --xpath '/rss/channel/item/enclosure/@*[local-name()="version"]' - | cut -d= -f2- | tr -d '"' | head -n1)"
|
||||||
|
|
||||||
|
findpath() {
|
||||||
|
path="$(nix --extra-experimental-features nix-command eval --json --impure -f "$nixpkgs" "$1.meta.position" | jq -r . | cut -d: -f1)"
|
||||||
|
outpath="$(nix --extra-experimental-features nix-command eval --json --impure --expr "builtins.fetchGit \"$nixpkgs\"")"
|
||||||
|
|
||||||
|
if [ -n "$outpath" ]; then
|
||||||
|
path="${path/$(echo "$outpath" | jq -r .)/$nixpkgs}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$path"
|
||||||
|
}
|
||||||
|
|
||||||
|
pkgpath="$(findpath "$attr")"
|
||||||
|
|
||||||
|
sed -i -e "/version\s*=/ s|\"$UPDATE_NIX_OLD_VERSION\"|\"$version\"|" "$pkgpath"
|
||||||
|
|
||||||
|
for system in aarch64-linux armv7l-linux x86_64-linux; do
|
||||||
|
url="$(nix --extra-experimental-features nix-command eval --json --impure --argstr system "$system" -f "$nixpkgs" "$attr".src.url | jq -r .)"
|
||||||
|
|
||||||
|
curhash="$(nix --extra-experimental-features nix-command eval --json --impure --argstr system "$system" -f "$nixpkgs" "$attr".src.outputHash | jq -r .)"
|
||||||
|
newhash="$(nix --extra-experimental-features nix-command store prefetch-file --json "$url" | jq -r .hash)"
|
||||||
|
|
||||||
|
sed -i -e "s|\"$curhash\"|\"$newhash\"|" "$pkgpath"
|
||||||
|
done
|
Loading…
Reference in a new issue