diff --git a/pkgs/by-name/id/idris2/unwrapped.nix b/pkgs/by-name/id/idris2/unwrapped.nix index 1aa7c86e9077..d932f720ba31 100644 --- a/pkgs/by-name/id/idris2/unwrapped.nix +++ b/pkgs/by-name/id/idris2/unwrapped.nix @@ -152,6 +152,8 @@ stdenv.mkDerivation (finalAttrs: { idris2-unwrapped = finalAttrs.finalPackage; extraPackages = f idris2Packages; }; + + updateScript = ./update.nu; }; meta = { diff --git a/pkgs/by-name/id/idris2/update.nu b/pkgs/by-name/id/idris2/update.nu new file mode 100755 index 000000000000..c687b4646d6e --- /dev/null +++ b/pkgs/by-name/id/idris2/update.nu @@ -0,0 +1,28 @@ +#!/usr/bin/env nix-shell +#! nix-shell -I ./. +#! nix-shell -i nu +#! nix-shell -p nushell nix + +const PACKAGE = './pkgs/by-name/id/idris2/package.nix' + +def main [] { + let tag = http get "https://api.github.com/repos/idris-lang/Idris2/releases" + | sort-by -r created_at + | first + | get tag_name + + print $"Newest version: ($tag)" + + let hash = run-external "nix" "flake" "prefetch" "--json" $"github:idris-lang/Idris2/($tag)" + | from json + | get hash + + let current_hash = nix eval -f ./. idris2.unwrapped.src.outputHash --json | from json + let current_version = nix eval -f ./. idris2.version --json | from json + + $PACKAGE + | open + | str replace $current_version ($tag | str trim -c 'v') + | str replace $current_hash $hash + | save -f $PACKAGE +}