Commit 88606829 authored by Peder Bergebakken Sundt's avatar Peder Bergebakken Sundt
Browse files

renoise: add update script

parent 833b18db
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
{ lib
, stdenv
, writeScript
, alsa-lib
, fetchurl
, libjack2
@@ -105,6 +106,27 @@ in stdenv.mkDerivation rec {
      --replace Exec=renoise Exec=$out/bin/renoise
  '';

  passthru.updateScript = writeScript "update-renoise" ''
    #!/usr/bin/env nix-shell
    #!nix-shell -I nixpkgs=./. -i bash -p curl htmlq common-updater-scripts
    set -euo pipefail

    new_version="$(
      curl 'https://files.renoise.com/demo/' \
        | htmlq a --text \
        | grep -E '^Renoise_([0-9]+_?)+_Demo_Linux_x86_64\.tar\.gz$' \
        | grep -Eo '[0-9]+(_[0-9]+)*' \
        | head -n1 \
        | tr _ .
    )"
    hash_x86_64="$(nix-prefetch-url "https://files.renoise.com/demo/Renoise_$(echo "$new_version" | tr . _)_Demo_Linux_x86_64.tar.gz")"
    hash_arm64="$( nix-prefetch-url "https://files.renoise.com/demo/Renoise_$(echo "$new_version" | tr . _)_Demo_Linux_arm64.tar.gz")"
    sri_x86_64="$(nix --extra-experimental-features nix-command hash to-sri --type sha256 "$hash_x86_64")"
    sri_arm64="$( nix --extra-experimental-features nix-command hash to-sri --type sha256 "$hash_arm64")"
    update-source-version renoise "$new_version" "$sri_x86_64" --system="x86_64-linux"  --ignore-same-version
    update-source-version renoise "$new_version" "$sri_arm64"  --system="aarch64-linux" --ignore-same-version
  '';

  meta = {
    description = "Modern tracker-based DAW";
    homepage = "https://www.renoise.com/";