Skip to content

Commit

Permalink
jetbrains: add plugin support
Browse files Browse the repository at this point in the history
  • Loading branch information
GenericNerdyUsername committed Mar 28, 2023
1 parent 6561f6b commit 9f81861
Show file tree
Hide file tree
Showing 8 changed files with 1,022 additions and 79 deletions.
37 changes: 19 additions & 18 deletions pkgs/applications/editors/jetbrains/darwin.nix
Expand Up @@ -10,27 +10,28 @@
, productShort ? product
, src
, version
, plugins ? [ ]
, ...
}:

let
loname = lib.toLower productShort;
in
stdenvNoCC.mkDerivation {
inherit pname meta src version;
desktopName = product;
installPhase = ''
runHook preInstall
APP_DIR="$out/Applications/${product}.app"
mkdir -p "$APP_DIR"
cp -Tr "${product}.app" "$APP_DIR"
mkdir -p "$out/bin"
cat << EOF > "$out/bin/${loname}"
open -na '$APP_DIR' --args "\$@"
EOF
chmod +x "$out/bin/${loname}"
runHook postInstall
'';
nativeBuildInputs = [ undmg ];
sourceRoot = ".";
}
stdenvNoCC.mkDerivation {
inherit pname meta src version plugins;
desktopName = product;
installPhase = ''
runHook preInstall
APP_DIR="$out/Applications/${product}.app"
mkdir -p "$APP_DIR"
cp -Tr "${product}.app" "$APP_DIR"
mkdir -p "$out/bin"
cat << EOF > "$out/bin/${loname}"
open -na '$APP_DIR' --args "\$@"
EOF
chmod +x "$out/bin/${loname}"
runHook postInstall
'';
nativeBuildInputs = [ undmg ];
sourceRoot = ".";
}
84 changes: 57 additions & 27 deletions pkgs/applications/editors/jetbrains/default.nix
@@ -1,5 +1,13 @@
{ lib, stdenv, callPackage, fetchurl
, jdk, cmake, gdb, zlib, python3, icu
{ lib
, stdenv
, callPackage
, fetchurl
, jdk
, cmake
, gdb
, zlib
, python3
, icu
, lldb
, dotnet-sdk_6
, maven
Expand All @@ -26,7 +34,7 @@ let

# Sorted alphabetically

buildClion = { pname, version, src, license, description, wmClass, ... }:
buildClion = { pname, version, src, license, description, wmClass, buildNumber, ... }:
(mkJetBrainsProduct {
inherit pname version src wmClass jdk;
product = "CLion";
Expand All @@ -38,13 +46,13 @@ let
developer on Linux, macOS and Windows.
'';
maintainers = with maintainers; [ edwtjo mic92 ];
inherit buildNumber;
};
}).overrideAttrs (attrs: {
nativeBuildInputs = (attrs.nativeBuildInputs or []) ++ lib.optionals (stdenv.isLinux) [
nativeBuildInputs = (attrs.nativeBuildInputs or [ ]) ++ lib.optionals (stdenv.isLinux) [
autoPatchelfHook
patchelf
];
buildInputs = (attrs.buildInputs or []) ++ lib.optionals (stdenv.isLinux) [
buildInputs = (attrs.buildInputs or [ ]) ++ lib.optionals (stdenv.isLinux) [
python3
stdenv.cc.cc
libdbusmenu
Expand All @@ -68,14 +76,13 @@ let
--replace-needed libcrypto.so.10 libcrypto.so
autoPatchelf $PWD/bin
wrapProgram $out/bin/clion \
--set CL_JDK "${jdk}"
)
'';
});

buildDataGrip = { pname, version, src, license, description, wmClass, ... }:
buildDataGrip = { pname, version, src, license, description, wmClass, buildNumber, ... }:
(mkJetBrainsProduct {
inherit pname version src wmClass jdk;
product = "DataGrip";
Expand All @@ -88,10 +95,11 @@ let
construct efficient, statically checked SQL queries and much more.
'';
maintainers = with maintainers; [ ];
inherit buildNumber;
};
});

buildGateway = { pname, version, src, license, description, wmClass, product, ... }:
buildGateway = { pname, version, src, license, description, wmClass, buildNumber, product, ... }:
(mkJetBrainsProduct {
inherit pname version src wmClass jdk product;
productShort = "Gateway";
Expand All @@ -104,10 +112,11 @@ let
backend, and opens your project in JetBrains Client.
'';
maintainers = with maintainers; [ kouyk ];
inherit buildNumber;
};
});

buildGoland = { pname, version, src, license, description, wmClass, ... }:
buildGoland = { pname, version, src, license, description, wmClass, buildNumber, ... }:
(mkJetBrainsProduct {
inherit pname version src wmClass jdk;
product = "Goland";
Expand All @@ -121,21 +130,20 @@ let
and tool integrations specific for the Go language
'';
maintainers = [ ];
inherit buildNumber;
};
}).overrideAttrs (attrs: {
postFixup = (attrs.postFixup or "") + lib.optionalString stdenv.isLinux ''
interp="$(cat $NIX_CC/nix-support/dynamic-linker)"
patchelf --set-interpreter $interp $out/goland/plugins/go-plugin/lib/dlv/linux/dlv
chmod +x $out/goland/plugins/go-plugin/lib/dlv/linux/dlv
# fortify source breaks build since delve compiles with -O0
wrapProgram $out/bin/goland \
--prefix CGO_CPPFLAGS " " "-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0"
'';
});

buildIdea = { pname, version, src, license, description, wmClass, product, ... }:
buildIdea = { pname, version, src, license, description, wmClass, buildNumber, product, ... }:
(mkJetBrainsProduct {
inherit pname version src wmClass jdk product;
productShort = "IDEA";
Expand All @@ -155,10 +163,11 @@ let
'';
maintainers = with maintainers; [ edwtjo gytis-ivaskevicius steinybot AnatolyPopov ];
platforms = ideaPlatforms;
inherit buildNumber;
};
});

buildMps = { pname, version, src, license, description, wmClass, product, ... }:
buildMps = { pname, version, src, license, description, wmClass, product, buildNumber, ... }:
(mkJetBrainsProduct rec {
inherit pname version src wmClass jdk product;
productShort = "MPS";
Expand All @@ -173,10 +182,11 @@ let
diagrams.
'';
maintainers = with maintainers; [ rasendubi ];
inherit buildNumber;
};
});

buildPhpStorm = { pname, version, src, license, description, wmClass, ... }:
buildPhpStorm = { pname, version, src, license, description, wmClass, buildNumber, ... }:
(mkJetBrainsProduct {
inherit pname version src wmClass jdk;
product = "PhpStorm";
Expand All @@ -189,10 +199,11 @@ let
automated refactorings for PHP and JavaScript code.
'';
maintainers = with maintainers; [ dritter ];
inherit buildNumber;
};
});

buildPycharm = { pname, version, src, license, description, wmClass, product, cythonSpeedup ? stdenv.isLinux, ... }:
buildPycharm = { pname, version, src, license, description, wmClass, buildNumber, product, cythonSpeedup ? stdenv.isLinux, ... }:
(mkJetBrainsProduct {
inherit pname version src wmClass jdk product;
productShort = "PyCharm";
Expand All @@ -213,22 +224,23 @@ let
providing you almost everything you need for your comfortable
and productive development!
'';
maintainers = with maintainers; [ ];
maintainers = with maintainers; [ genericnerdyusername ];
inherit buildNumber;
};
}).overrideAttrs (finalAttrs: previousAttrs: lib.optionalAttrs cythonSpeedup {
buildInputs = with python3.pkgs; [ python3 setuptools ];
preInstall = ''
echo "compiling cython debug speedups"
if [[ -d plugins/python-ce ]]; then
${python3.interpreter} plugins/python-ce/helpers/pydev/setup_cython.py build_ext --inplace
else
${python3.interpreter} plugins/python/helpers/pydev/setup_cython.py build_ext --inplace
fi
echo "compiling cython debug speedups"
if [[ -d plugins/python-ce ]]; then
${python3.interpreter} plugins/python-ce/helpers/pydev/setup_cython.py build_ext --inplace
else
${python3.interpreter} plugins/python/helpers/pydev/setup_cython.py build_ext --inplace
fi
'';
# See https://www.jetbrains.com/help/pycharm/2022.1/cython-speedups.html
});

buildRider = { pname, version, src, license, description, wmClass, ... }:
buildRider = { pname, version, src, license, description, wmClass, buildNumber, ... }:
(mkJetBrainsProduct {
inherit pname version src wmClass jdk;
product = "Rider";
Expand All @@ -246,6 +258,7 @@ let
ASP.NET Core web applications.
'';
maintainers = with maintainers; [ raphaelr ];
inherit buildNumber;
};
}).overrideAttrs (attrs: {
postPatch = lib.optionalString (!stdenv.isDarwin) (attrs.postPatch + ''
Expand All @@ -259,7 +272,7 @@ let
'');
});

buildRubyMine = { pname, version, src, license, description, wmClass, ... }:
buildRubyMine = { pname, version, src, license, description, wmClass, buildNumber, ... }:
(mkJetBrainsProduct {
inherit pname version src wmClass jdk;
product = "RubyMine";
Expand All @@ -268,10 +281,11 @@ let
inherit description license platforms;
longDescription = description;
maintainers = with maintainers; [ edwtjo ];
inherit buildNumber;
};
});

buildWebStorm = { pname, version, src, license, description, wmClass, ... }:
buildWebStorm = { pname, version, src, license, description, wmClass, buildNumber, ... }:
(mkJetBrainsProduct {
inherit pname version src wmClass jdk;
product = "WebStorm";
Expand All @@ -284,6 +298,7 @@ let
automated refactorings for JavaScript code.
'';
maintainers = with maintainers; [ abaldeau ];
inherit buildNumber;
};
});

Expand All @@ -295,7 +310,8 @@ in
clion = buildClion rec {
pname = "clion";
version = products.clion.version;
description = "C/C++ IDE. New. Intelligent. Cross-platform";
buildNumber = products.clion.build_number;
description = "C/C++ IDE. New. Intelligent. Cross-platform";
license = lib.licenses.unfree;
src = fetchurl {
url = products.clion.url;
Expand All @@ -308,6 +324,7 @@ in
datagrip = buildDataGrip rec {
pname = "datagrip";
version = products.datagrip.version;
buildNumber = products.datagrip.build_number;
description = "Your Swiss Army Knife for Databases and SQL";
license = lib.licenses.unfree;
src = fetchurl {
Expand All @@ -322,6 +339,7 @@ in
pname = "gateway";
product = "JetBrains Gateway";
version = products.gateway.version;
buildNumber = products.gateway.build_number;
description = "Your single entry point to all remote development environments";
license = lib.licenses.unfree;
src = fetchurl {
Expand All @@ -335,6 +353,7 @@ in
goland = buildGoland rec {
pname = "goland";
version = products.goland.version;
buildNumber = products.goland.build_number;
description = "Up and Coming Go IDE";
license = lib.licenses.unfree;
src = fetchurl {
Expand All @@ -349,6 +368,7 @@ in
pname = "idea-community";
product = "IntelliJ IDEA CE";
version = products.idea-community.version;
buildNumber = products.idea-community.build_number;
description = "Integrated Development Environment (IDE) by Jetbrains, community edition";
license = lib.licenses.asl20;
src = fetchurl {
Expand All @@ -363,6 +383,7 @@ in
pname = "idea-ultimate";
product = "IntelliJ IDEA";
version = products.idea-ultimate.version;
buildNumber = products.idea-ultimate.build_number;
description = "Integrated Development Environment (IDE) by Jetbrains, requires paid license";
license = lib.licenses.unfree;
src = fetchurl {
Expand All @@ -377,6 +398,7 @@ in
pname = "mps";
product = "MPS ${products.mps.version}";
version = products.mps.version;
buildNumber = products.mps.build_number;
description = "Create your own domain-specific language";
license = lib.licenses.asl20;
src = fetchurl {
Expand All @@ -390,6 +412,7 @@ in
phpstorm = buildPhpStorm rec {
pname = "phpstorm";
version = products.phpstorm.version;
buildNumber = products.phpstorm.build_number;
description = "Professional IDE for Web and PHP developers";
license = lib.licenses.unfree;
src = fetchurl {
Expand All @@ -404,6 +427,7 @@ in
pname = "pycharm-community";
product = "PyCharm CE";
version = products.pycharm-community.version;
buildNumber = products.pycharm-community.build_number;
description = "PyCharm Community Edition";
license = lib.licenses.asl20;
src = fetchurl {
Expand All @@ -418,6 +442,7 @@ in
pname = "pycharm-professional";
product = "PyCharm";
version = products.pycharm-professional.version;
buildNumber = products.pycharm-community.build_number;
description = "PyCharm Professional Edition";
license = lib.licenses.unfree;
src = fetchurl {
Expand All @@ -431,6 +456,7 @@ in
rider = buildRider rec {
pname = "rider";
version = products.rider.version;
buildNumber = products.rider.build_number;
description = "A cross-platform .NET IDE based on the IntelliJ platform and ReSharper";
license = lib.licenses.unfree;
src = fetchurl {
Expand All @@ -444,6 +470,7 @@ in
ruby-mine = buildRubyMine rec {
pname = "ruby-mine";
version = products.ruby-mine.version;
buildNumber = products.ruby-mine.build_number;
description = "The Most Intelligent Ruby and Rails IDE";
license = lib.licenses.unfree;
src = fetchurl {
Expand All @@ -457,6 +484,7 @@ in
webstorm = buildWebStorm rec {
pname = "webstorm";
version = products.webstorm.version;
buildNumber = products.webstorm.build_number;
description = "Professional IDE for Web and JavaScript development";
license = lib.licenses.unfree;
src = fetchurl {
Expand All @@ -467,4 +495,6 @@ in
update-channel = products.webstorm.update-channel;
};

plugins = callPackage ./plugins { };

}

0 comments on commit 9f81861

Please sign in to comment.