nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchurl,
5 makeWrapper,
6 makeDesktopItem,
7 which,
8 unzip,
9 libicns,
10 imagemagick,
11 jdk21,
12 perl,
13}:
14
15let
16 version = "28";
17 desktopItem = makeDesktopItem {
18 name = "netbeans";
19 exec = "netbeans";
20 comment = "Integrated Development Environment";
21 desktopName = "Apache NetBeans IDE";
22 genericName = "Integrated Development Environment";
23 categories = [ "Development" ];
24 icon = "netbeans";
25 };
26in
27stdenv.mkDerivation {
28 pname = "netbeans";
29 inherit version;
30 src = fetchurl {
31 url = "mirror://apache/netbeans/netbeans/${version}/netbeans-${version}-bin.zip";
32 hash = "sha256-ALn6XALAcQbf6zeoieKgTj4sUis24VzzfTHukPoa/DI=";
33 };
34
35 buildCommand = ''
36 # Unpack and perform some path patching.
37 unzip $src
38 patchShebangs .
39
40 rm netbeans/bin/*.exe
41
42 # Copy to installation directory and create a wrapper capable of starting
43 # it.
44 mkdir -pv $out/bin
45 cp -a netbeans $out
46 makeWrapper $out/netbeans/bin/netbeans $out/bin/netbeans \
47 --prefix PATH : ${
48 lib.makeBinPath [
49 jdk21
50 which
51 ]
52 } \
53 --prefix JAVA_HOME : ${jdk21.home} \
54 --add-flags "--jdkhome ${jdk21.home} \
55 -J-Dawt.useSystemAAFontSettings=gasp -J-Dswing.aatext=true"
56
57 # Extract pngs from the Apple icon image and create
58 # the missing ones from the 1024x1024 image.
59 icns2png --extract $out/netbeans/nb/netbeans.icns
60 for size in 16 24 32 48 64 128 256 512 1024; do
61 mkdir -pv $out/share/icons/hicolor/"$size"x"$size"/apps
62 if [ -e netbeans_"$size"x"$size"x32.png ]
63 then
64 mv netbeans_"$size"x"$size"x32.png $out/share/icons/hicolor/"$size"x"$size"/apps/netbeans.png
65 else
66 convert -resize "$size"x"$size" netbeans_1024x1024x32.png $out/share/icons/hicolor/"$size"x"$size"/apps/netbeans.png
67 fi
68 done;
69
70 # Create desktop item, so we can pick it from the KDE/GNOME menu
71 mkdir -pv $out/share/applications
72 ln -s ${desktopItem}/share/applications/* $out/share/applications
73 '';
74
75 nativeBuildInputs = [
76 makeWrapper
77 unzip
78 ];
79 buildInputs = [
80 perl
81 libicns
82 imagemagick
83 ];
84
85 meta = {
86 description = "Integrated development environment for Java, C, C++ and PHP";
87 homepage = "https://netbeans.apache.org/";
88 license = lib.licenses.asl20;
89 sourceProvenance = with lib.sourceTypes; [
90 binaryBytecode
91 binaryNativeCode
92 ];
93 maintainers = with lib.maintainers; [
94 rszibele
95 kashw2
96 ];
97 platforms = lib.platforms.unix;
98 mainProgram = "netbeans";
99 };
100}