From b02032e10e7074c24e1f1ae8fc90207b46fc1fd6 Mon Sep 17 00:00:00 2001 From: Matt McHenry Date: Mon, 31 Mar 2025 14:38:18 -0400 Subject: [PATCH 1/4] eclipses: retire scala SDK this is almost eight years out of date, no longer published by upstream, and impedes the creation of an automated update script. --- pkgs/applications/editors/eclipse/default.nix | 23 ------------------- 1 file changed, 23 deletions(-) diff --git a/pkgs/applications/editors/eclipse/default.nix b/pkgs/applications/editors/eclipse/default.nix index 4319728e258b..2db9b320b63f 100644 --- a/pkgs/applications/editors/eclipse/default.nix +++ b/pkgs/applications/editors/eclipse/default.nix @@ -150,29 +150,6 @@ rec { }; }; - ### Eclipse Scala SDK - - eclipse-scala-sdk = - (buildEclipseUnversioned.override - { - jdk = jdk8; - gtk = gtk2; - } - { - name = "eclipse-scala-sdk-4.7.0"; - description = "Eclipse IDE for Scala Developers"; - productVersion = "4.7"; - src = fetchurl { - url = "https://downloads.typesafe.com/scalaide-pack/4.7.0-vfinal-oxygen-212-20170929/scala-SDK-4.7.0-vfinal-2.12-linux.gtk.x86_64.tar.gz"; - sha256 = "1n5w2a7mh9ajv6fxcas1gpgwb04pdxbr9v5dzr67gsz5bhahq4ya"; - }; - } - ).overrideAttrs - (oa: { - # Only download for x86_64 - meta.platforms = [ "x86_64-linux" ]; - }); - ### Eclipse SDK eclipse-sdk = buildEclipse { From 376fba433223f76ed2b483c47c36efb5fb966ed2 Mon Sep 17 00:00:00 2001 From: Matt McHenry Date: Mon, 31 Mar 2025 14:52:57 -0400 Subject: [PATCH 2/4] eclipses: extract eclipses.json this lays the groundwork for a fully-automatic update script --- pkgs/applications/editors/eclipse/default.nix | 207 ++++-------------- .../editors/eclipse/eclipses.json | 90 ++++++++ 2 files changed, 132 insertions(+), 165 deletions(-) create mode 100644 pkgs/applications/editors/eclipse/eclipses.json diff --git a/pkgs/applications/editors/eclipse/default.nix b/pkgs/applications/editors/eclipse/default.nix index 2db9b320b63f..db85c9ccfb4c 100644 --- a/pkgs/applications/editors/eclipse/default.nix +++ b/pkgs/applications/editors/eclipse/default.nix @@ -28,12 +28,18 @@ # for e in cpp dsl embedcpp modeling platform sdk java jee committers rcp; do for s in pkgs pkgsCross.aarch64-multiplatform; do echo; echo $s $e; nix-build -A ${s}.eclipses.eclipse-${e} -o eclipse-${s}-${e}; done; done let - platform_major = "4"; - platform_minor = "34"; - year = "2024"; - month = "12"; # release month - buildmonth = "11"; # sometimes differs from release month - timestamp = "${year}${buildmonth}201800"; + eclipses = lib.trivial.importJSON ./eclipses.json; + inherit (eclipses) + platform_major + platform_minor + year + # release month sometimes differs from build month + month + buildmonth + dayHourMinute + ; + timestamp = "${year}${buildmonth}${dayHourMinute}"; + gtk = gtk3; arch = if stdenv.hostPlatform.isx86_64 then @@ -42,8 +48,6 @@ let "aarch64" else throw "don't know what platform suffix for ${stdenv.hostPlatform.system} will be"; -in -rec { # work around https://bugs.eclipse.org/bugs/show_bug.cgi?id=476075#c3 buildEclipseUnversioned = callPackage ./build-eclipse.nix { @@ -70,165 +74,38 @@ rec { eclipseData // { productVersion = "${platform_major}.${platform_minor}"; } ); - ### Eclipse CPP + generateEclipse = + id: + { + description, + hashes, + dropUrl, + }: + builtins.listToAttrs [ + { + name = "eclipse-${lib.strings.toLower id}"; + value = buildEclipse { + name = "eclipse-${lib.strings.toLower id}-${platform_major}.${platform_minor}"; + inherit description; + src = fetchurl { + url = + if dropUrl then + "https://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/eclipse/downloads/drops${platform_major}/R-${platform_major}.${platform_minor}-${timestamp}/eclipse-${id}-${platform_major}.${platform_minor}-linux-gtk-${arch}.tar.gz" + else + "https://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/technology/epp/downloads/release/${year}-${month}/R/eclipse-${id}-${year}-${month}-R-linux-gtk-${arch}.tar.gz"; + hash = hashes.${arch}; + }; + }; + } + ]; - eclipse-cpp = buildEclipse { - name = "eclipse-cpp-${platform_major}.${platform_minor}"; - description = "Eclipse IDE for C/C++ Developers"; - src = fetchurl { - url = "https://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/technology/epp/downloads/release/${year}-${month}/R/eclipse-cpp-${year}-${month}-R-linux-gtk-${arch}.tar.gz"; - hash = - { - x86_64 = "sha256-d3MVeci4jF9adqvgepmZtzoPul+DTMtJlf7v92PMyq0="; - aarch64 = "sha256-gsOmF3bGthd7CEG+HxEQJqACfb+ErWU+fVO2MVR2cz8="; - } - .${arch}; - }; - }; + generatedEclipses = lib.attrsets.concatMapAttrs generateEclipse eclipses.eclipses; - ### Eclipse DSL - - eclipse-dsl = buildEclipse { - name = "eclipse-dsl-${platform_major}.${platform_minor}"; - description = "Eclipse IDE for Java and DSL Developers"; - src = fetchurl { - url = "https://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/technology/epp/downloads/release/${year}-${month}/R/eclipse-dsl-${year}-${month}-R-linux-gtk-${arch}.tar.gz"; - hash = - { - x86_64 = "sha256-bJvODmesfkED5yHnaJGLZSeFctfVCQDA3lvH00S/zbk="; - aarch64 = "sha256-e0rWjD19tUyVJMMbb5THVj28o0HnBFssP0yCAQ5wKnA="; - } - .${arch}; - }; - }; - - ### Eclipse IDE for Embedded C/C++ Developers - - eclipse-embedcpp = buildEclipse { - name = "eclipse-embedcpp-${platform_major}.${platform_minor}"; - description = "Eclipse IDE for Embedded C/C++ Developers"; - src = fetchurl { - url = "https://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/technology/epp/downloads/release/${year}-${month}/R/eclipse-embedcpp-${year}-${month}-R-linux-gtk-${arch}.tar.gz"; - hash = - { - x86_64 = "sha256-+DfoJ+QAlI9Ioz4Wbj2LvtpV3vAXjl0wtZBNS9osOYw="; - aarch64 = "sha256-XCpIKoLhrodOJkLPY6uICpuYu5PBUp96MFQCeuOyOUA="; - } - .${arch}; - }; - }; - - ### Eclipse Modeling - - eclipse-modeling = buildEclipse { - name = "eclipse-modeling-${platform_major}.${platform_minor}"; - description = "Eclipse Modeling Tools"; - src = fetchurl { - url = "https://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/technology/epp/downloads/release/${year}-${month}/R/eclipse-modeling-${year}-${month}-R-linux-gtk-${arch}.tar.gz"; - hash = - { - x86_64 = "sha256-MUe5DU+3/4lzG1hykpgOX/46Pgp9qtoN9MOYk6EFK6o="; - aarch64 = "sha256-/tv7+RsRAFfV5zfU+uFNNlE1rrJavRFOhLYhSkIX0Ec="; - } - .${arch}; - }; - }; - - ### Eclipse Platform - - eclipse-platform = buildEclipse { - name = "eclipse-platform-${platform_major}.${platform_minor}"; - description = "Eclipse Platform ${year}-${month}"; - src = fetchurl { - url = "https://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/eclipse/downloads/drops${platform_major}/R-${platform_major}.${platform_minor}-${timestamp}/eclipse-platform-${platform_major}.${platform_minor}-linux-gtk-${arch}.tar.gz"; - hash = - { - x86_64 = "sha256-ZHJkIOAaz87z6Dz/6X62E7ckQIFDtzqgE5ODZeb/Rss="; - aarch64 = "sha256-dLLwLFTeUXoL9Pri4EB48nZGUH/zF2mCt6anv519aP4="; - } - .${arch}; - }; - }; - - ### Eclipse SDK - - eclipse-sdk = buildEclipse { - name = "eclipse-sdk-${platform_major}.${platform_minor}"; - description = "Eclipse ${year}-${month} Classic"; - src = fetchurl { - url = "https://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/eclipse/downloads/drops${platform_major}/R-${platform_major}.${platform_minor}-${timestamp}/eclipse-SDK-${platform_major}.${platform_minor}-linux-gtk-${arch}.tar.gz"; - hash = - { - x86_64 = "sha256-DhrNe9nx4RYAaq+NIHCBLX+bOn+dE13yF07hjuRzHZI="; - aarch64 = "sha256-OHE0vxjV9kp43Os2LCLuZFCMLWy3vnCChMC54TyXO9I="; - } - .${arch}; - }; - }; - - ### Eclipse Java - - eclipse-java = buildEclipse { - name = "eclipse-java-${platform_major}.${platform_minor}"; - description = "Eclipse IDE for Java Developers"; - src = fetchurl { - url = "https://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/technology/epp/downloads/release/${year}-${month}/R/eclipse-java-${year}-${month}-R-linux-gtk-${arch}.tar.gz"; - hash = - { - x86_64 = "sha256-z0hLFqdDSqhUmCiOp0fkTkiybOmCIA118JMBb90yEiY="; - aarch64 = "sha256-JzUgyfPEi9vq497gJhHuobb0TR113hC2suFvNKix7So="; - } - .${arch}; - }; - }; - - ### Eclipse Java EE - - eclipse-jee = buildEclipse { - name = "eclipse-jee-${platform_major}.${platform_minor}"; - description = "Eclipse IDE for Enterprise Java and Web Developers"; - src = fetchurl { - url = "https://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/technology/epp/downloads/release/${year}-${month}/R/eclipse-jee-${year}-${month}-R-linux-gtk-${arch}.tar.gz"; - hash = - { - x86_64 = "sha256-PxQ+jGTEs917IeWuTCgyyx7vAodZr4ju/aa4WQmoGQ0="; - aarch64 = "sha256-g4EHYFjoPONiGwreAmENcXWVinPkDAIE6KyVmZokQAo="; - } - .${arch}; - }; - }; - - ### Eclipse Committers - - eclipse-committers = buildEclipse { - name = "eclipse-committers-${platform_major}.${platform_minor}"; - description = "Eclipse IDE for Eclipse Committers and Eclipse Platform Plugin Developers"; - src = fetchurl { - url = "https://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/technology/epp/downloads/release/${year}-${month}/R/eclipse-committers-${year}-${month}-R-linux-gtk-${arch}.tar.gz"; - hash = - { - x86_64 = "sha256-g8ILZ9esbXbm+4bImFJkEwE/UNJT2HHCXx/8i+Lvb00="; - aarch64 = "sha256-arV2VgQypj8fSEpqGd8CbJ/FyKE6k+e4x7kXqShDKrw="; - } - .${arch}; - }; - }; - - ### Eclipse IDE for RCP and RAP Developers - - eclipse-rcp = buildEclipse { - name = "eclipse-rcp-${platform_major}.${platform_minor}"; - description = "Eclipse IDE for RCP and RAP Developers"; - src = fetchurl { - url = "https://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/technology/epp/downloads/release/${year}-${month}/R/eclipse-rcp-${year}-${month}-R-linux-gtk-${arch}.tar.gz"; - hash = - { - x86_64 = "sha256-qqOdASLe11FT4Eot7j/Yf02acHgblV77W3fqTOCrNSQ="; - aarch64 = "sha256-9yA2OLOcp3uKJ88OKqz7vCXMzS52om6ohUJkGZpkjE4="; - } - .${arch}; - }; - }; +in +generatedEclipses +// { + # expose this function so users can build their own eclipses if needed + inherit buildEclipse; ### Environments diff --git a/pkgs/applications/editors/eclipse/eclipses.json b/pkgs/applications/editors/eclipse/eclipses.json new file mode 100644 index 000000000000..b1bec5fa677f --- /dev/null +++ b/pkgs/applications/editors/eclipse/eclipses.json @@ -0,0 +1,90 @@ +{ + "platform_major": "4", + "platform_minor": "34", + "year": "2024", + "month": "12", + "buildmonth": "11", + "dayHourMinute": "201800", + "eclipses": { + "cpp": { + "description": "Eclipse IDE for C/C++ Developers", + "dropUrl": false, + "hashes": { + "x86_64": "sha256-d3MVeci4jF9adqvgepmZtzoPul+DTMtJlf7v92PMyq0=", + "aarch64": "sha256-gsOmF3bGthd7CEG+HxEQJqACfb+ErWU+fVO2MVR2cz8=" + } + }, + "dsl": { + "description": "Eclipse IDE for Java and DSL Developers", + "dropUrl": false, + "hashes": { + "x86_64": "sha256-bJvODmesfkED5yHnaJGLZSeFctfVCQDA3lvH00S/zbk=", + "aarch64": "sha256-e0rWjD19tUyVJMMbb5THVj28o0HnBFssP0yCAQ5wKnA=" + } + }, + "embedcpp": { + "description": "Eclipse IDE for Embedded C/C++ Developers", + "dropUrl": false, + "hashes": { + "x86_64": "sha256-+DfoJ+QAlI9Ioz4Wbj2LvtpV3vAXjl0wtZBNS9osOYw=", + "aarch64": "sha256-XCpIKoLhrodOJkLPY6uICpuYu5PBUp96MFQCeuOyOUA=" + } + }, + "modeling": { + "description": "Eclipse Modeling Tools", + "dropUrl": false, + "hashes": { + "x86_64": "sha256-MUe5DU+3/4lzG1hykpgOX/46Pgp9qtoN9MOYk6EFK6o=", + "aarch64": "sha256-/tv7+RsRAFfV5zfU+uFNNlE1rrJavRFOhLYhSkIX0Ec=" + } + }, + "platform": { + "description": "Eclipse Platform ${year}-${month}", + "dropUrl": true, + "hashes": { + "x86_64": "sha256-ZHJkIOAaz87z6Dz/6X62E7ckQIFDtzqgE5ODZeb/Rss=", + "aarch64": "sha256-dLLwLFTeUXoL9Pri4EB48nZGUH/zF2mCt6anv519aP4=" + } + }, + "SDK": { + "description": "Eclipse ${year}-${month} Classic", + "dropUrl": true, + "hashes": { + "x86_64": "sha256-DhrNe9nx4RYAaq+NIHCBLX+bOn+dE13yF07hjuRzHZI=", + "aarch64": "sha256-OHE0vxjV9kp43Os2LCLuZFCMLWy3vnCChMC54TyXO9I=" + } + }, + "java": { + "description": "Eclipse IDE for Java Developers", + "dropUrl": false, + "hashes": { + "x86_64": "sha256-z0hLFqdDSqhUmCiOp0fkTkiybOmCIA118JMBb90yEiY=", + "aarch64": "sha256-JzUgyfPEi9vq497gJhHuobb0TR113hC2suFvNKix7So=" + } + }, + "jee": { + "description": "Eclipse IDE for Enterprise Java and Web Developers", + "dropUrl": false, + "hashes": { + "x86_64": "sha256-PxQ+jGTEs917IeWuTCgyyx7vAodZr4ju/aa4WQmoGQ0=", + "aarch64": "sha256-g4EHYFjoPONiGwreAmENcXWVinPkDAIE6KyVmZokQAo=" + } + }, + "committers": { + "description": "Eclipse IDE for Eclipse Committers and Eclipse Platform Plugin Developers", + "dropUrl": false, + "hashes": { + "x86_64": "sha256-g8ILZ9esbXbm+4bImFJkEwE/UNJT2HHCXx/8i+Lvb00=", + "aarch64": "sha256-arV2VgQypj8fSEpqGd8CbJ/FyKE6k+e4x7kXqShDKrw=" + } + }, + "rcp": { + "description": "Eclipse IDE for RCP and RAP Developers", + "dropUrl": false, + "hashes": { + "x86_64": "sha256-qqOdASLe11FT4Eot7j/Yf02acHgblV77W3fqTOCrNSQ=", + "aarch64": "sha256-9yA2OLOcp3uKJ88OKqz7vCXMzS52om6ohUJkGZpkjE4=" + } + } + } +} From 5bb31f9518544f18e49365e7f32e43ff049aa341 Mon Sep 17 00:00:00 2001 From: Matt McHenry Date: Tue, 1 Apr 2025 12:10:03 -0400 Subject: [PATCH 3/4] eclipses: implement an updateScript this is a relatively simple recasting of the existing update script, using the "object addition" feature of 'jq' to incrementally update the eclipses.json document with the URL components and their hashes. it does end up defining the same update script for every eclipse packaging, but in local testing, maintainers/scripts/update.nix seems smart enough to realize it should only run that script once. --- .../editors/eclipse/build-eclipse.nix | 2 + pkgs/applications/editors/eclipse/update.sh | 43 ++++++++----------- 2 files changed, 19 insertions(+), 26 deletions(-) diff --git a/pkgs/applications/editors/eclipse/build-eclipse.nix b/pkgs/applications/editors/eclipse/build-eclipse.nix index 2852d7649ad6..de6f6f01d8c0 100644 --- a/pkgs/applications/editors/eclipse/build-eclipse.nix +++ b/pkgs/applications/editors/eclipse/build-eclipse.nix @@ -110,6 +110,8 @@ stdenv.mkDerivation rec { perl -i -p0e 's|-vm\nplugins/org.eclipse.justj.*/jre/bin.*\n||' $out/eclipse/eclipse.ini ''; # */ + passthru.updateScript = ./update.sh; + meta = { homepage = "https://www.eclipse.org/"; inherit description; diff --git a/pkgs/applications/editors/eclipse/update.sh b/pkgs/applications/editors/eclipse/update.sh index 01b3ec5fa57b..fd3798cd19ea 100755 --- a/pkgs/applications/editors/eclipse/update.sh +++ b/pkgs/applications/editors/eclipse/update.sh @@ -38,36 +38,27 @@ case "$buildmonth" in '11'|'01') month='12' ;; esac -cat < $t; +mv $t $ECLIPSES_JSON; # prefetch new download hashes -echo; -echo "paste the following url + hash blocks into pkgs/applications/editors/eclipse/default.nix:"; - -for url in $(grep 'url = ' pkgs/applications/editors/eclipse/default.nix | grep arch | cut -d '"' -f 2); do - u=$(echo "$url" | sed 's/&/\\&/g'); - echo; - echo " url = \"${url}\";"; - echo " hash = {"; +for id in $(cat $ECLIPSES_JSON | jq -r '.eclipses | keys | .[]'); do for arch in x86_64 aarch64; do - us=$(eval echo "$u"); - h=$(nix store prefetch-file --json "$us" | jq -r .hash); - echo " $arch = \"${h}\";"; + if [ $(cat $ECLIPSES_JSON | jq -r ".eclipses.${id}.dropUrl") == "true" ]; then + url="https://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/eclipse/downloads/drops${platform_major}/R-${platform_major}.${platform_minor}-${timestamp}/eclipse-${id}-${platform_major}.${platform_minor}-linux-gtk-${arch}.tar.gz"; + else + url="https://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/technology/epp/downloads/release/${year}-${month}/R/eclipse-${id}-${year}-${month}-R-linux-gtk-${arch}.tar.gz"; + fi + + echo "prefetching ${id} ${arch}"; + h=$(nix store prefetch-file --json "$url" | jq -r .hash); + + t=$(mktemp); + cat $ECLIPSES_JSON | jq -r ".eclipses.${id}.hashes.${arch} = \"${h}\"" > $t; + mv $t $ECLIPSES_JSON; done - echo ' }.${arch};'; done From 9c24350f073616e3959e44c1b9b6ff05b8b46cc0 Mon Sep 17 00:00:00 2001 From: Matt McHenry Date: Tue, 1 Apr 2025 13:29:36 -0400 Subject: [PATCH 4/4] eclipses: add self as maintainer --- pkgs/applications/editors/eclipse/build-eclipse.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/applications/editors/eclipse/build-eclipse.nix b/pkgs/applications/editors/eclipse/build-eclipse.nix index de6f6f01d8c0..829ab15e622c 100644 --- a/pkgs/applications/editors/eclipse/build-eclipse.nix +++ b/pkgs/applications/editors/eclipse/build-eclipse.nix @@ -120,6 +120,7 @@ stdenv.mkDerivation rec { "x86_64-linux" "aarch64-linux" ]; + maintainers = [ lib.maintainers.jerith666 ]; }; }