···
1
-
{ lib, stdenv, fetchzip, jre, makeWrapper }:
2
-
stdenv.mkDerivation rec {
1
+
{ lib, maven, fetchFromGitHub, jre, makeWrapper, nix-update-script }:
3
+
maven.buildMavenPackage rec {
7
+
outputs = [ "out" "doc" ];
7
-
url = "https://github.com/h2database/h2database/releases/download/version-${version}/h2-2023-07-04.zip";
8
-
hash = "sha256-nSOkCZuHcy0GR4SRjx524+MLqxJyO1PRkImPOFR1yts=";
9
+
src = fetchFromGitHub {
10
+
owner = "h2database";
11
+
repo = "h2database";
12
+
rev = "refs/tags/version-${version}";
13
+
hash = "sha256-pS9jSiuInA0eULPOZK5cjwr9y5KDVY51blhZ9vs4z+g=";
11
-
outputs = [ "out" "doc" ];
16
+
mvnParameters = "-f h2/pom.xml -DskipTests";
17
+
mvnHash = "sha256-hUzE4F+RNCAfoY836pjrivf04xqN4m9SkiLXhmVzZRA=";
nativeBuildInputs = [ makeWrapper ];
21
-
if [ -n "$1" ]; then
22
-
${jre}/bin/java -cp "$dir/h2-${version}.jar:$H2DRIVERS:$CLASSPATH" $1 "''${@:2}"
24
-
echo "You have to provide the full java class path for the h2 tool you want to run. E.g. 'org.h2.tools.Server'"
28
-
mkdir -p $out $doc/share/doc/
30
-
cp -R docs $doc/share/doc/h2
22
+
mkdir -p $out/share/java
23
+
install -Dm644 h2/target/h2-${version}.jar $out/share/java
32
-
echo '${h2ToolScript}' > $out/bin/h2tool.sh
25
+
makeWrapper ${jre}/bin/java $out/bin/h2 \
26
+
--add-flags "-cp \"$out/share/java/h2-${version}.jar:\$H2DRIVERS:\$CLASSPATH\" org.h2.tools.Console"
34
-
substituteInPlace $out/bin/h2.sh --replace "java" "${jre}/bin/java"
28
+
mkdir -p $doc/share/doc/h2
29
+
cp -r h2/src/docsrc/* $doc/share/doc/h2
36
-
chmod +x $out/bin/*.sh
32
+
passthru.updateScript = nix-update-script {
33
+
extraArgs = [ "--version-regex" "^version-([0-9.]+)$" ];
description = "The Java SQL database";
41
-
homepage = "http://www.h2database.com/html/main.html";
42
-
sourceProvenance = with sourceTypes; [ binaryBytecode ];
38
+
homepage = "https://h2database.com/html/main.html";
39
+
changelog = "https://h2database.com/html/changelog.html";
license = licenses.mpl20;
44
-
platforms = lib.platforms.linux;
45
-
maintainers = with maintainers; [ mahe ];
41
+
platforms = lib.platforms.unix;
42
+
maintainers = with maintainers; [ mahe anthonyroussel ];