blob: bc400fc5b37c2dc3ac51ae9d8279cd17bd49678c (
plain)
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
{
lib,
stdenv,
fetchurl,
openjdk11,
unzip,
makeWrapper,
makeDesktopItem,
copyDesktopItems,
xdg-utils,
imagemagick,
maxMemoryAllocationPool ? "1000M",
}:
stdenv.mkDerivation rec {
pname = "weka";
version = "3.9.6";
src = fetchurl {
url = "mirror://sourceforge/weka/${lib.replaceStrings [ "." ] [ "-" ] "weka-${version}"}.zip";
sha256 = "sha256-8fVN4MXYqXNEmyVtXh1IrauHTBZWgWG8AvsGI5Y9Aj0=";
};
nativeBuildInputs = [
makeWrapper
unzip
imagemagick
]
++ lib.optionals stdenv.hostPlatform.isLinux [ copyDesktopItems ];
# The -Xmx1000M comes suggested from their download page:
# https://www.cs.waikato.ac.nz/ml/weka/downloading.html
installPhase = ''
runHook preInstall
mkdir -pv $out/share/weka
mkdir -p $out/share/icons/hicolor
cp -Rv * $out/share/weka
makeWrapper ${openjdk11}/bin/java $out/bin/weka \
--add-flags "-Xmx${maxMemoryAllocationPool} -jar $out/share/weka/weka.jar"
makeWrapper ${openjdk11}/bin/java $out/bin/weka-java \
--add-flags "-Xmx${maxMemoryAllocationPool} -cp $out/share/weka/weka.jar"
${lib.optionalString stdenv.hostPlatform.isLinux "
makeWrapper ${xdg-utils}/bin/xdg-open $out/bin/weka-doc --add-flags $out/share/weka/documentation.html
"}
cat << EOF > $out/bin/weka-home
#!${stdenv.shell}
echo -n $out/share/weka
EOF
chmod ugo+x $out/bin/weka-home
for n in 16 24 32 48 64 96 128 256; do
size=$n"x"$n
mkdir -p $out/share/icons/hicolor/$size/apps
magick convert $out/share/weka/weka.gif -resize $size $out/share/icons/hicolor/$size/apps/weka.png
done;
runHook postInstall
'';
desktopItems = [
(makeDesktopItem {
name = "weka";
exec = "weka";
icon = "weka";
desktopName = "WEKA";
categories = [
"Science"
"ArtificialIntelligence"
"ComputerScience"
];
})
(makeDesktopItem {
name = "weka-doc";
exec = "weka-doc";
icon = "weka";
desktopName = "View the WEKA documentation with a web browser";
categories = [
"Science"
"ArtificialIntelligence"
"ComputerScience"
];
})
];
meta = {
homepage = "https://www.cs.waikato.ac.nz/ml/weka/";
description = "Collection of machine learning algorithms for data mining tasks";
mainProgram = "weka";
sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
license = lib.licenses.gpl2Plus;
maintainers = [ lib.maintainers.mimame ];
platforms = lib.platforms.unix;
};
}
|