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 Apr 23, 2023
1 parent f423f57 commit 79d6b66
Show file tree
Hide file tree
Showing 8 changed files with 1,089 additions and 90 deletions.
39 changes: 21 additions & 18 deletions pkgs/applications/editors/jetbrains/darwin.nix
Expand Up @@ -10,27 +10,30 @@
, productShort ? product
, src
, version
, plugins ? [ ]
, buildNumber
, ...
}:

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;
passthru.buildNumber = buildNumber;
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 = ".";
}
95 changes: 57 additions & 38 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 Down Expand Up @@ -27,9 +35,9 @@ 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;
inherit pname version src wmClass jdk buildNumber;
product = "CLion";
meta = with lib; {
homepage = "https://www.jetbrains.com/clion/";
Expand All @@ -41,11 +49,10 @@ let
maintainers = with maintainers; [ edwtjo mic92 ];
};
}).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 @@ -70,16 +77,15 @@ 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;
inherit pname version src wmClass jdk buildNumber;
product = "DataGrip";
meta = with lib; {
homepage = "https://www.jetbrains.com/datagrip/";
Expand All @@ -93,9 +99,9 @@ let
};
});

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;
inherit pname version src wmClass jdk buildNumber product;
productShort = "Gateway";
meta = with lib; {
homepage = "https://www.jetbrains.com/remote-development/gateway/";
Expand All @@ -109,9 +115,9 @@ let
};
});

buildGoland = { pname, version, src, license, description, wmClass, ... }:
buildGoland = { pname, version, src, license, description, wmClass, buildNumber, ... }:
(mkJetBrainsProduct {
inherit pname version src wmClass jdk;
inherit pname version src wmClass jdk buildNumber;
product = "Goland";
meta = with lib; {
homepage = "https://www.jetbrains.com/go/";
Expand All @@ -128,18 +134,16 @@ let
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;
inherit pname version src wmClass jdk buildNumber product;
productShort = "IDEA";
extraLdPath = [ zlib ];
extraWrapperArgs = [
Expand All @@ -160,9 +164,9 @@ let
};
});

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;
inherit pname version src wmClass jdk buildNumber product;
productShort = "MPS";
meta = with lib; {
broken = (stdenv.isLinux && stdenv.isAarch64);
Expand All @@ -178,9 +182,9 @@ let
};
});

buildPhpStorm = { pname, version, src, license, description, wmClass, ... }:
buildPhpStorm = { pname, version, src, license, description, wmClass, buildNumber, ... }:
(mkJetBrainsProduct {
inherit pname version src wmClass jdk;
inherit pname version src wmClass jdk buildNumber;
product = "PhpStorm";
meta = with lib; {
homepage = "https://www.jetbrains.com/phpstorm/";
Expand All @@ -194,9 +198,9 @@ let
};
});

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;
inherit pname version src wmClass jdk buildNumber product;
productShort = "PyCharm";
meta = with lib; {
broken = (stdenv.isLinux && stdenv.isAarch64);
Expand All @@ -215,24 +219,24 @@ let
providing you almost everything you need for your comfortable
and productive development!
'';
maintainers = with maintainers; [ ];
maintainers = with maintainers; [ genericnerdyusername ];
};
}).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;
inherit pname version src wmClass jdk buildNumber;
product = "Rider";
# icu is required by Rider.Backend
extraLdPath = [ icu ];
Expand Down Expand Up @@ -261,9 +265,9 @@ let
'');
});

buildRubyMine = { pname, version, src, license, description, wmClass, ... }:
buildRubyMine = { pname, version, src, license, description, wmClass, buildNumber, ... }:
(mkJetBrainsProduct {
inherit pname version src wmClass jdk;
inherit pname version src wmClass jdk buildNumber;
product = "RubyMine";
meta = with lib; {
homepage = "https://www.jetbrains.com/ruby/";
Expand All @@ -273,9 +277,9 @@ let
};
});

buildWebStorm = { pname, version, src, license, description, wmClass, ... }:
buildWebStorm = { pname, version, src, license, description, wmClass, buildNumber, ... }:
(mkJetBrainsProduct {
inherit pname version src wmClass jdk;
inherit pname version src wmClass jdk buildNumber;
product = "WebStorm";
meta = with lib; {
homepage = "https://www.jetbrains.com/webstorm/";
Expand All @@ -297,7 +301,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 @@ -310,6 +315,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 @@ -324,6 +330,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 @@ -337,6 +344,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 @@ -351,6 +359,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 @@ -365,6 +374,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 @@ -379,6 +389,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 @@ -392,6 +403,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 @@ -406,6 +418,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 @@ -420,6 +433,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 @@ -433,6 +447,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 @@ -446,6 +461,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 @@ -459,6 +475,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 @@ -469,4 +486,6 @@ in
update-channel = products.webstorm.update-channel;
};

plugins = callPackage ./plugins { };

}

0 comments on commit 79d6b66

Please sign in to comment.