diff options
Diffstat (limited to 'nixpkgs/pkgs/applications/editors/netbeans/default.nix')
-rw-r--r-- | nixpkgs/pkgs/applications/editors/netbeans/default.nix | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/applications/editors/netbeans/default.nix b/nixpkgs/pkgs/applications/editors/netbeans/default.nix new file mode 100644 index 000000000000..83c5bb6f9309 --- /dev/null +++ b/nixpkgs/pkgs/applications/editors/netbeans/default.nix @@ -0,0 +1,69 @@ +{ lib, stdenv, fetchurl, makeWrapper, makeDesktopItem, which, unzip, libicns, imagemagick +, jdk, perl, python +}: + +let + version = "12.3"; + desktopItem = makeDesktopItem { + name = "netbeans"; + exec = "netbeans"; + comment = "Integrated Development Environment"; + desktopName = "Apache NetBeans IDE"; + genericName = "Integrated Development Environment"; + categories = "Development;"; + icon = "netbeans"; + }; +in +stdenv.mkDerivation { + pname = "netbeans"; + inherit version; + src = fetchurl { + url = "mirror://apache/netbeans/netbeans/${version}/netbeans-${version}-bin.zip"; + sha512 = "2fy696qrfbdkzmq4cwd6l7v6rsc0bf9akh61w3azc544bq3vxl3v6s31hvg3ba0nsh0jv3nbdrk6jp1l4hwgcg9zg7kf2012a1vv2nk"; + }; + + buildCommand = '' + # Unpack and perform some path patching. + unzip $src + patchShebangs . + + rm netbeans/bin/*.exe + + # Copy to installation directory and create a wrapper capable of starting + # it. + mkdir -pv $out/bin + cp -a netbeans $out + makeWrapper $out/netbeans/bin/netbeans $out/bin/netbeans \ + --prefix PATH : ${lib.makeBinPath [ jdk which ]} \ + --prefix JAVA_HOME : ${jdk.home} \ + --add-flags "--jdkhome ${jdk.home}" + + # Extract pngs from the Apple icon image and create + # the missing ones from the 1024x1024 image. + icns2png --extract $out/netbeans/nb/netbeans.icns + for size in 16 24 32 48 64 128 256 512 1024; do + mkdir -pv $out/share/icons/hicolor/"$size"x"$size"/apps + if [ -e netbeans_"$size"x"$size"x32.png ] + then + mv netbeans_"$size"x"$size"x32.png $out/share/icons/hicolor/"$size"x"$size"/apps/netbeans.png + else + convert -resize "$size"x"$size" netbeans_1024x1024x32.png $out/share/icons/hicolor/"$size"x"$size"/apps/netbeans.png + fi + done; + + # Create desktop item, so we can pick it from the KDE/GNOME menu + mkdir -pv $out/share/applications + ln -s ${desktopItem}/share/applications/* $out/share/applications + ''; + + nativeBuildInputs = [ makeWrapper unzip ]; + buildInputs = [ perl python libicns imagemagick ]; + + meta = { + description = "An integrated development environment for Java, C, C++ and PHP"; + homepage = "https://netbeans.apache.org/"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ sander rszibele asbachb ]; + platforms = lib.platforms.unix; + }; +} |