blob: 7ec4dea0534292b4b2b313b5281926b4be5335ff (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
{ lib
, stdenv
, fetchFromGitHub
, jdk
, makeWrapper
, buildNativeImage ? false
}:
stdenv.mkDerivation rec {
pname = "dbqn" + lib.optionalString buildNativeImage "-native";
version = "0.2.2";
src = fetchFromGitHub {
owner = "dzaima";
repo = "BQN";
rev = "v${version}";
hash = "sha256-AUfT7l7zr/pyG63wX8FMej8RUg7tXC1aroCrunjyw/8=";
};
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/dbqn
mv BQN.jar $out/share/dbqn/
makeWrapper "${lib.getBin jdk}/bin/java" "$out/bin/dbqn" \
--add-flags "-jar $out/share/dbqn/BQN.jar"
'') + ''
ln -s $out/bin/dbqn $out/bin/bqn
runHook postInstall
'';
meta = with lib; {
homepage = "https://github.com/dzaima/BQN";
description = "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.hostPlatform.isDarwin; # never built on Hydra https://hydra.nixos.org/job/nixpkgs/staging-next/dbqn-native.x86_64-darwin
};
}
# TODO: Processing app
# TODO: minimalistic JDK
|