idris2: Add updateScript

This commit is contained in:
Ross Smyth
2025-10-21 12:47:02 -04:00
parent efa5600771
commit 159c2cb894
2 changed files with 30 additions and 0 deletions
+2
View File
@@ -152,6 +152,8 @@ stdenv.mkDerivation (finalAttrs: {
idris2-unwrapped = finalAttrs.finalPackage;
extraPackages = f idris2Packages;
};
updateScript = ./update.nu;
};
meta = {
+28
View File
@@ -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
}