nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1#!/usr/bin/env nix-shell
2#! nix-shell -I ./.
3#! nix-shell -i nu
4#! nix-shell -p nushell nix
5
6const ARCHES = [
7 { name: "x86_64-linux", target: "x86_64-unknown-linux-gnu" },
8 { name: "x86_64-darwin", target: "x86_64-apple-darwin" },
9 { name: "aarch64-linux", target: "aarch64-unknown-linux-gnu" },
10 { name: "aarch64-darwin", target: "aarch64-apple-darwin" },
11];
12
13const MANIFEST = "pkgs/by-name/bu/buck2/hashes.json"
14
15def main [] {
16 let version = http get "https://api.github.com/repos/facebook/buck2/releases"
17 | sort-by -r created_at
18 | where prerelease == true and name != "latest"
19 | first
20 | get name
21
22 let preludeHash = http get $"https://github.com/facebook/buck2/releases/download/($version)/prelude_hash" | decode | str trim
23 let preludeFod = run-external "nix" "--extra-experimental-features" "nix-command" "store" "prefetch-file" "--json" $"https://github.com/facebook/buck2-prelude/archive/($preludeHash).tar.gz" | from json | get hash
24
25 print $"Newest version: ($version)"
26 print $"Newest prelude hash: ($preludeHash)"
27
28 let hashes = $ARCHES | par-each {
29 |arch|
30
31 {
32 $arch.name: {
33 "buck2": (run-external "nix" "--extra-experimental-features" "nix-command" "store" "prefetch-file" "--json" $"https://github.com/facebook/buck2/releases/download/($version)/buck2-($arch.target).zst" | from json | get hash),
34 "rust-project": (run-external "nix" "--extra-experimental-features" "nix-command" "store" "prefetch-file" "--json" $"https://github.com/facebook/buck2/releases/download/($version)/rust-project-($arch.target).zst" | from json | get hash),
35 }
36 }
37 } | reduce { |val, accum| $accum | merge $val }
38
39 let new_manifest = $hashes
40 | insert "version" $version
41 | insert "preludeGit" $preludeHash
42 | insert "preludeFod" $preludeFod
43
44 $new_manifest
45 | to json
46 | append "\n"
47 | str join
48 | save -f $MANIFEST
49}