diff options
author | Anderson Torres <torres.anderson.85@protonmail.com> | 2024-05-29 03:55:01 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-29 06:55:01 +0000 |
commit | dcc123b7336b827bb1f06ff2288b9ea94f0cc21c (patch) | |
tree | ae9b21edd17b23910fd298f788444b6585b5c147 /pkgs/by-name/db | |
parent | 23381e72e1d62a4bb21731a9a166f1c60866f219 (diff) |
dbqn: migrate to by-name (#314612)
Also, changed the default `buildNativeImage` to false, in order not to bring graalvm-ce as a dependency by accident.
Diffstat (limited to 'pkgs/by-name/db')
-rw-r--r-- | pkgs/by-name/db/dbqn/package.nix | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/pkgs/by-name/db/dbqn/package.nix b/pkgs/by-name/db/dbqn/package.nix new file mode 100644 index 0000000000000..240729a465136 --- /dev/null +++ b/pkgs/by-name/db/dbqn/package.nix @@ -0,0 +1,72 @@ +{ lib +, stdenv +, fetchFromGitHub +, jdk +, makeWrapper +, buildNativeImage ? false +}: + +stdenv.mkDerivation rec { + pname = "dbqn" + lib.optionalString buildNativeImage "-native"; + version = "0.2.1"; + + src = fetchFromGitHub { + owner = "dzaima"; + repo = "BQN"; + rev = "v${version}"; + sha256 = "1kxzxz2hrd1871281s4rsi569qk314aqfmng9pkqn8gv9nqhmph0"; + }; + + nativeBuildInputs = [ + jdk + makeWrapper + ]; + + dontConfigure = true; + + postPatch = '' + patchShebangs --build ./build8 + ''; + + buildPhase = '' + runHook preBuild + + ./build8 + '' + lib.optionalString buildNativeImage '' + native-image --report-unsupported-elements-at-runtime \ + -H:CLibraryPath=${lib.getLib jdk}/lib -J-Dfile.encoding=UTF-8 \ + -jar BQN.jar dbqn + '' + '' + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + + mkdir -p $out/bin + + '' + (if buildNativeImage then '' + mv dbqn $out/bin + '' else '' + mkdir -p $out/share/${pname} + mv BQN.jar $out/share/${pname}/ + + makeWrapper "${lib.getBin jdk}/bin/java" "$out/bin/dbqn" \ + --add-flags "-jar $out/share/${pname}/BQN.jar" + '') + '' + ln -s $out/bin/dbqn $out/bin/bqn + + runHook postInstall + ''; + + meta = with lib; { + homepage = "https://github.com/dzaima/BQN"; + description = "A BQN implementation in Java" + lib.optionalString buildNativeImage ", compiled as a native image"; + license = licenses.mit; + maintainers = with maintainers; [ AndersonTorres sternenseemann ]; + inherit (jdk.meta) platforms; + broken = stdenv.isDarwin; # never built on Hydra https://hydra.nixos.org/job/nixpkgs/staging-next/dbqn-native.x86_64-darwin + }; +} +# TODO: Processing app +# TODO: minimalistic JDK |