1 #!/usr/bin/env nix-shell
2 #! nix-shell -i bash --pure -p curl cacert libxml2 yq nix jq
3 #! nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/3c7487575d9445185249a159046cc02ff364bff8.tar.gz
6 # nixos-unstable ~ 2023-07-06 -----------------/
11 # scrape the downloads page for release info
13 curl
-s -o eclipse-dl.html https
://download.eclipse.org
/eclipse
/downloads
/
14 trap "rm eclipse-dl.html" EXIT
18 xmllint
--html eclipse-dl.html
--xmlout 2>/dev
/null | xq
-r ".html.body.main.div.table[3].tr[1].td[0].a${q}";
21 # extract release info from download page HTML
23 platform_major
=$
(dlquery
'."#text" | split(".") | .[0]' -r);
24 platform_minor
=$
(dlquery
'."#text" | split(".") | .[1]' -r);
26 year
=$
(dlquery
'."@href" | split("/") | .[] | select(. | startswith("R")) | split("-") | .[2] | .[0:4]')
27 buildmonth
=$
(dlquery
'."@href" | split("/") | .[] | select(. | startswith("R")) | split("-") | .[2] | .[4:6]')
28 builddaytime
=$
(dlquery
'."@href" | split("/") | .[] | select(. | startswith("R")) | split("-") | .[2] | .[6:12]')
29 timestamp
="${year}${buildmonth}${builddaytime}";
31 # account for possible release-month vs. build-month mismatches
35 '02'|
'04') month
='03' ;;
36 '05'|
'07') month
='06' ;;
37 '08'|
'10') month
='09' ;;
38 '11'|
'01') month
='12' ;;
43 paste the following into the 'let' block near the top of pkgs/applications/editors/eclipse/default.nix:
45 platform_major = "${platform_major}";
46 platform_minor = "${platform_minor}";
48 month = "${month}"; #release month
49 buildmonth = "${buildmonth}"; #sometimes differs from release month
50 timestamp = "\${year}\${buildmonth}${builddaytime}";
53 # strip existing download hashes
55 sed -i 's/64 = ".*";$/64 = "";/g' pkgs
/applications
/editors
/eclipse
/default.nix
57 # prefetch new download hashes
60 echo "paste the following url + hash blocks into pkgs/applications/editors/eclipse/default.nix:";
62 for url
in $
(grep 'url = ' pkgs
/applications
/editors
/eclipse
/default.nix |
grep arch | cut
-d '"' -f 2); do
63 u
=$
(echo "$url" |
sed 's/&/\\&/g');
65 echo " url = \"${url}\";";
67 for arch
in x86_64 aarch64
; do
69 h
=$
(nix store prefetch-file
--json "$us" | jq
-r .
hash);
70 echo " $arch = \"${h}\";";