about summary refs log tree commit diff
path: root/nixpkgs/pkgs/servers/h2
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-11-20 14:55:32 +0100
committerAlyssa Ross <hi@alyssa.is>2023-11-20 14:55:32 +0100
commit34b58aaefccdb5c64b912903973ba729bae58be3 (patch)
treee18a96bc0f066422356a8da655453403baa97e64 /nixpkgs/pkgs/servers/h2
parent7be318098d7fe87d896e8787bfadc0345149cb59 (diff)
parent3fb937a1e9f4157f57011965b99fcb7f4139d9ad (diff)
downloadnixlib-34b58aaefccdb5c64b912903973ba729bae58be3.tar
nixlib-34b58aaefccdb5c64b912903973ba729bae58be3.tar.gz
nixlib-34b58aaefccdb5c64b912903973ba729bae58be3.tar.bz2
nixlib-34b58aaefccdb5c64b912903973ba729bae58be3.tar.lz
nixlib-34b58aaefccdb5c64b912903973ba729bae58be3.tar.xz
nixlib-34b58aaefccdb5c64b912903973ba729bae58be3.tar.zst
nixlib-34b58aaefccdb5c64b912903973ba729bae58be3.zip
Merge branch 'nixos-unstable-small' of https://github.com/NixOS/nixpkgs
Diffstat (limited to 'nixpkgs/pkgs/servers/h2')
-rw-r--r--nixpkgs/pkgs/servers/h2/default.nix60
1 files changed, 29 insertions, 31 deletions
diff --git a/nixpkgs/pkgs/servers/h2/default.nix b/nixpkgs/pkgs/servers/h2/default.nix
index 3ec3c396a7e8..84a8b98b6dfc 100644
--- a/nixpkgs/pkgs/servers/h2/default.nix
+++ b/nixpkgs/pkgs/servers/h2/default.nix
@@ -1,47 +1,45 @@
-{ lib, stdenv, fetchzip, jre, makeWrapper }:
-stdenv.mkDerivation rec {
+{ lib, maven, fetchFromGitHub, jre, makeWrapper, nix-update-script }:
+
+maven.buildMavenPackage rec {
   pname = "h2";
-  version = "2.2.220";
+  version = "2.2.224";
+
+  outputs = [ "out" "doc" ];
 
-  src = fetchzip {
-    url = "https://github.com/h2database/h2database/releases/download/version-${version}/h2-2023-07-04.zip";
-    hash = "sha256-nSOkCZuHcy0GR4SRjx524+MLqxJyO1PRkImPOFR1yts=";
+  src = fetchFromGitHub {
+    owner = "h2database";
+    repo = "h2database";
+    rev = "refs/tags/version-${version}";
+    hash = "sha256-pS9jSiuInA0eULPOZK5cjwr9y5KDVY51blhZ9vs4z+g=";
   };
 
-  outputs = [ "out" "doc" ];
+  mvnParameters = "-f h2/pom.xml -DskipTests";
+  mvnHash = "sha256-hUzE4F+RNCAfoY836pjrivf04xqN4m9SkiLXhmVzZRA=";
 
   nativeBuildInputs = [ makeWrapper ];
 
-  installPhase =
-    let
-      h2ToolScript = ''
-        #!/usr/bin/env bash
-        dir=$(dirname "$0")
-
-        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
+  installPhase = ''
+    mkdir -p $out/share/java
+    install -Dm644 h2/target/h2-${version}.jar $out/share/java
 
-      echo '${h2ToolScript}' > $out/bin/h2tool.sh
+    makeWrapper ${jre}/bin/java $out/bin/h2 \
+      --add-flags "-cp \"$out/share/java/h2-${version}.jar:\$H2DRIVERS:\$CLASSPATH\" org.h2.tools.Console"
 
-      substituteInPlace $out/bin/h2.sh --replace "java" "${jre}/bin/java"
+    mkdir -p $doc/share/doc/h2
+    cp -r h2/src/docsrc/* $doc/share/doc/h2
+  '';
 
-      chmod +x $out/bin/*.sh
-    '';
+  passthru.updateScript = nix-update-script {
+    extraArgs = [ "--version-regex" "^version-([0-9.]+)$" ];
+  };
 
   meta = with lib; {
     description = "The Java SQL database";
-    homepage = "http://www.h2database.com/html/main.html";
-    sourceProvenance = with sourceTypes; [ binaryBytecode ];
+    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 ];
+    platforms = lib.platforms.unix;
+    maintainers = with maintainers; [ mahe anthonyroussel ];
+    mainProgram = "h2";
   };
 }