From a132640b2f711bd1360c3663044928a9aed7191b Mon Sep 17 00:00:00 2001 From: Anthony Roussel Date: Wed, 15 Nov 2023 18:15:53 +0100 Subject: [PATCH 1/5] h2: 2.2.220 -> 2.2.224 https://github.com/h2database/h2database/compare/version-2.2.220...version-2.2.224 --- pkgs/servers/h2/default.nix | 51 ++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 29 deletions(-) diff --git a/pkgs/servers/h2/default.nix b/pkgs/servers/h2/default.nix index 3ec3c396a7e8..1edde85898ee 100644 --- a/pkgs/servers/h2/default.nix +++ b/pkgs/servers/h2/default.nix @@ -1,45 +1,38 @@ -{ lib, stdenv, fetchzip, jre, makeWrapper }: -stdenv.mkDerivation rec { - pname = "h2"; - version = "2.2.220"; +{ lib, maven, fetchFromGitHub, jre, makeWrapper }: - src = fetchzip { - url = "https://github.com/h2database/h2database/releases/download/version-${version}/h2-2023-07-04.zip"; - hash = "sha256-nSOkCZuHcy0GR4SRjx524+MLqxJyO1PRkImPOFR1yts="; - }; +maven.buildMavenPackage rec { + pname = "h2"; + version = "2.2.224"; outputs = [ "out" "doc" ]; + src = fetchFromGitHub { + owner = "h2database"; + repo = "h2database"; + rev = "refs/tags/version-${version}"; + hash = "sha256-pS9jSiuInA0eULPOZK5cjwr9y5KDVY51blhZ9vs4z+g="; + }; + + mvnParameters = "-f h2/pom.xml -DskipTests"; + mvnHash = "sha256-hUzE4F+RNCAfoY836pjrivf04xqN4m9SkiLXhmVzZRA="; + nativeBuildInputs = [ makeWrapper ]; - installPhase = - let - h2ToolScript = '' - #!/usr/bin/env bash - dir=$(dirname "$0") + installPhase = '' + mkdir -p $out/share/java + install -Dm644 h2/target/h2-${version}.jar $out/share/java - if [ -n "$1" ]; then - ${jre}/bin/java -cp "$dir/h2-${version}.jar:$H2DRIVERS:$CLASSPATH" $1 "''${@:2}" - else - echo "You have to provide the full java class path for the h2 tool you want to run. E.g. 'org.h2.tools.Server'" - fi - ''; - in '' - mkdir -p $out $doc/share/doc/ - cp -R bin $out/ - cp -R docs $doc/share/doc/h2 + makeWrapper ${jre}/bin/java $out/bin/h2 \ + --add-flags "-cp \"$out/share/java/h2-${version}.jar:\$H2DRIVERS:\$CLASSPATH\" org.h2.tools.Console" - echo '${h2ToolScript}' > $out/bin/h2tool.sh + mkdir -p $doc/share/doc/h2 + cp -r h2/src/docsrc/* $doc/share/doc/h2 + ''; - substituteInPlace $out/bin/h2.sh --replace "java" "${jre}/bin/java" - - chmod +x $out/bin/*.sh - ''; meta = with lib; { description = "The Java SQL database"; homepage = "http://www.h2database.com/html/main.html"; - sourceProvenance = with sourceTypes; [ binaryBytecode ]; license = licenses.mpl20; platforms = lib.platforms.linux; maintainers = with maintainers; [ mahe ]; From 209b5b57076dfcdb47a2e6abf85e3bf5264d7847 Mon Sep 17 00:00:00 2001 From: Anthony Roussel Date: Wed, 15 Nov 2023 18:17:19 +0100 Subject: [PATCH 2/5] h2: add passthru.updateScript --- pkgs/servers/h2/default.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/servers/h2/default.nix b/pkgs/servers/h2/default.nix index 1edde85898ee..ab8249d7f28c 100644 --- a/pkgs/servers/h2/default.nix +++ b/pkgs/servers/h2/default.nix @@ -1,4 +1,4 @@ -{ lib, maven, fetchFromGitHub, jre, makeWrapper }: +{ lib, maven, fetchFromGitHub, jre, makeWrapper, nix-update-script }: maven.buildMavenPackage rec { pname = "h2"; @@ -29,6 +29,9 @@ maven.buildMavenPackage rec { cp -r h2/src/docsrc/* $doc/share/doc/h2 ''; + passthru.updateScript = nix-update-script { + extraArgs = [ "--version-regex" "^version-([0-9.]+)$" ]; + }; meta = with lib; { description = "The Java SQL database"; From 978161f76e61d44db6a18ef2b10bbf19aa3a0277 Mon Sep 17 00:00:00 2001 From: Anthony Roussel Date: Wed, 15 Nov 2023 18:17:50 +0100 Subject: [PATCH 3/5] h2: add anthonyroussel to maintainers --- pkgs/servers/h2/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/servers/h2/default.nix b/pkgs/servers/h2/default.nix index ab8249d7f28c..f8135f326b38 100644 --- a/pkgs/servers/h2/default.nix +++ b/pkgs/servers/h2/default.nix @@ -38,6 +38,6 @@ maven.buildMavenPackage rec { homepage = "http://www.h2database.com/html/main.html"; license = licenses.mpl20; platforms = lib.platforms.linux; - maintainers = with maintainers; [ mahe ]; + maintainers = with maintainers; [ mahe anthonyroussel ]; }; } From bd0e98160dd8b6bac9eb2c197921f2b03d6afcec Mon Sep 17 00:00:00 2001 From: Anthony Roussel Date: Wed, 15 Nov 2023 18:17:32 +0100 Subject: [PATCH 4/5] h2: add meta.{changelog,mainProgram} --- pkgs/servers/h2/default.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/servers/h2/default.nix b/pkgs/servers/h2/default.nix index f8135f326b38..b06d0464deab 100644 --- a/pkgs/servers/h2/default.nix +++ b/pkgs/servers/h2/default.nix @@ -35,9 +35,11 @@ maven.buildMavenPackage rec { meta = with lib; { description = "The Java SQL database"; - homepage = "http://www.h2database.com/html/main.html"; + homepage = "https://h2database.com/html/main.html"; + changelog = "https://h2database.com/html/changelog.html"; license = licenses.mpl20; platforms = lib.platforms.linux; maintainers = with maintainers; [ mahe anthonyroussel ]; + mainProgram = "h2"; }; } From 08e2f9caeb1a2bff4f82b0b16ccf43d64136664b Mon Sep 17 00:00:00 2001 From: Anthony Roussel Date: Wed, 15 Nov 2023 18:35:42 +0100 Subject: [PATCH 5/5] h2: add darwin support --- pkgs/servers/h2/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/servers/h2/default.nix b/pkgs/servers/h2/default.nix index b06d0464deab..84a8b98b6dfc 100644 --- a/pkgs/servers/h2/default.nix +++ b/pkgs/servers/h2/default.nix @@ -38,7 +38,7 @@ maven.buildMavenPackage rec { homepage = "https://h2database.com/html/main.html"; changelog = "https://h2database.com/html/changelog.html"; license = licenses.mpl20; - platforms = lib.platforms.linux; + platforms = lib.platforms.unix; maintainers = with maintainers; [ mahe anthonyroussel ]; mainProgram = "h2"; };