about summary refs log tree commit diff
path: root/pkgs/applications/audio/open-stage-control
diff options
context:
space:
mode:
authorfigsoda <figsoda@pm.me>2023-02-11 22:22:55 -0500
committerfigsoda <figsoda@pm.me>2023-02-11 22:22:55 -0500
commit8c4ef82faf61c34c08a08af7848fa729f10fad3f (patch)
tree3c1b7a38f7831308cb1d917ef7cff275c835fee1 /pkgs/applications/audio/open-stage-control
parent78367ae5cbc49899e69c3d58ed83df264e583528 (diff)
open-stage-control: use nix-update-script
Diffstat (limited to 'pkgs/applications/audio/open-stage-control')
-rw-r--r--pkgs/applications/audio/open-stage-control/default.nix4
-rwxr-xr-xpkgs/applications/audio/open-stage-control/update.sh51
2 files changed, 2 insertions, 53 deletions
diff --git a/pkgs/applications/audio/open-stage-control/default.nix b/pkgs/applications/audio/open-stage-control/default.nix
index 0860501c87c45..71fc1f103b9b5 100644
--- a/pkgs/applications/audio/open-stage-control/default.nix
+++ b/pkgs/applications/audio/open-stage-control/default.nix
@@ -1,4 +1,4 @@
-{ lib, buildNpmPackage, fetchFromGitHub, makeBinaryWrapper, makeDesktopItem, copyDesktopItems, electron, python3 }:
+{ lib, buildNpmPackage, fetchFromGitHub, makeBinaryWrapper, makeDesktopItem, copyDesktopItems, electron, python3, nix-update-script }:
 
 buildNpmPackage rec {
   pname = "open-stage-control";
@@ -71,7 +71,7 @@ buildNpmPackage rec {
     })
   ];
 
-  passthru.updateScript = ./update.sh;
+  passthru.updateScript = nix-update-script { };
 
   meta = with lib; {
     description = "Libre and modular OSC / MIDI controller";
diff --git a/pkgs/applications/audio/open-stage-control/update.sh b/pkgs/applications/audio/open-stage-control/update.sh
deleted file mode 100755
index 30f1b4c293f16..0000000000000
--- a/pkgs/applications/audio/open-stage-control/update.sh
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/env nix-shell
-#! nix-shell -i bash -p common-updater-scripts jq nodejs
-set -euo pipefail
-
-# Find nixpkgs repo
-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))"
-
-stripwhitespace() {
-    sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//'
-}
-
-nixeval() {
-    nix --extra-experimental-features nix-command eval --json --impure -f "$nixpkgs" "$1" | jq -r .
-}
-
-vendorhash() {
-    (nix --extra-experimental-features nix-command build --impure --argstr nixpkgs "$nixpkgs" --argstr attr "$1" --expr '{ nixpkgs, attr }: let pkgs = import nixpkgs {}; in with pkgs.lib; (getAttrFromPath (splitString "." attr) pkgs).overrideAttrs (attrs: { outputHash = fakeHash; })' --no-link 2>&1 >/dev/null | tail -n3 | grep -F got: | cut -d: -f2- | stripwhitespace) 2>/dev/null || true
-}
-
-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"
-}
-
-attr="${UPDATE_NIX_ATTR_PATH:-open-stage-control}"
-version="$(cd "$nixpkgs" && list-git-tags --pname="$(nixeval "$attr".pname)" --attr-path="$attr" | grep '^v' | sed -e 's|^v||' | sort -V | tail -n1)"
-
-pkgpath="$(findpath "$attr")"
-
-updated="$(cd "$nixpkgs" && update-source-version "$attr" "$version" --file="$pkgpath" --print-changes | jq -r length)"
-
-if [ "$updated" -eq 0 ]; then
-    echo 'update.sh: Package version not updated, nothing to do.'
-    exit 0
-fi
-
-# Update FOD hash
-curhash="$(nixeval "$attr.npmDeps.outputHash")"
-newhash="$(vendorhash "$attr.npmDeps")"
-
-if [ -n "$newhash" ] && [ "$curhash" != "$newhash" ]; then
-    sed -i -e "s|\"$curhash\"|\"$newhash\"|" "$pkgpath"
-else
-    echo 'update.sh: New npmDepsHash same as old npmDepsHash, nothing to do.'
-fi