diff --git a/pkgs/by-name/gr/graphite/package.nix b/pkgs/by-name/gr/graphite/package.nix index df9c0ef9d7a4..86af4e92af49 100644 --- a/pkgs/by-name/gr/graphite/package.nix +++ b/pkgs/by-name/gr/graphite/package.nix @@ -27,7 +27,6 @@ libxcursor, libx11, libxcb, - nix-update-script, }: let @@ -173,12 +172,7 @@ stdenv.mkDerivation (finalAttrs: { disallowedReferences = [ rustc ]; - passthru.updateScript = nix-update-script { - extraArgs = [ - "--version=branch" - "--version-regex=(0-unstable-.*)" - ]; - }; + passthru.updateScript = ./update.nu; meta = { description = "Open source vector graphics editor and procedural design engine"; diff --git a/pkgs/by-name/gr/graphite/update.nu b/pkgs/by-name/gr/graphite/update.nu new file mode 100755 index 000000000000..816acbe71f41 --- /dev/null +++ b/pkgs/by-name/gr/graphite/update.nu @@ -0,0 +1,14 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i nu -p nushell nix-update curl common-updater-scripts nix + +^nix-update graphite --version=branch --version-regex '(0-unstable-.*)' + +let pkg = "./pkgs/by-name/gr/graphite/package.nix" +let rev = (open $pkg | lines | where ($it | str contains 'rev = "') | first | str trim | parse 'rev = "{rev}";' | get 0.rev) +let meta = (http get $"https://raw.githubusercontent.com/GraphiteEditor/Graphite/($rev)/.branding" | lines) +let branding_rev = ($meta | get 0 | path basename | str replace ".tar.gz" "") +let branding_hash = (^nix hash convert --to sri --hash-algo sha256 ($meta | get 1) | str trim) +open $pkg +| str replace --regex 'brandingRev = "[^"]*"' $'brandingRev = "($branding_rev)"' +| str replace --regex 'brandingHash = "[^"]*"' $'brandingHash = "($branding_hash)"' +| save --force $pkg