2023-03-28 15:23:01 +00:00
|
|
|
{
|
|
|
|
stdenv,
|
|
|
|
lib,
|
|
|
|
makeDesktopItem,
|
|
|
|
makeWrapper,
|
|
|
|
patchelf,
|
|
|
|
writeText,
|
|
|
|
coreutils,
|
|
|
|
gnugrep,
|
|
|
|
which,
|
|
|
|
git,
|
|
|
|
unzip,
|
|
|
|
libsecret,
|
|
|
|
libnotify,
|
2023-08-14 12:09:39 +00:00
|
|
|
udev,
|
2023-03-28 15:23:01 +00:00
|
|
|
e2fsprogs,
|
|
|
|
python3,
|
2023-09-22 19:23:03 +00:00
|
|
|
autoPatchelfHook,
|
2023-03-28 15:23:01 +00:00
|
|
|
vmopts ? null,
|
2024-06-23 19:37:17 +00:00
|
|
|
glibcLocales,
|
2018-03-03 13:34:44 +00:00
|
|
|
}:
|
2016-01-15 17:18:54 +00:00
|
|
|
|
2023-03-28 15:23:01 +00:00
|
|
|
{
|
|
|
|
pname,
|
|
|
|
product,
|
|
|
|
productShort ? product,
|
|
|
|
version,
|
|
|
|
src,
|
|
|
|
wmClass,
|
|
|
|
buildNumber,
|
|
|
|
jdk,
|
|
|
|
meta,
|
2023-09-22 19:23:03 +00:00
|
|
|
libdbm,
|
|
|
|
fsnotifier,
|
2023-03-28 15:23:01 +00:00
|
|
|
extraLdPath ? [ ],
|
|
|
|
extraWrapperArgs ? [ ],
|
2023-09-22 19:23:03 +00:00
|
|
|
extraBuildInputs ? [ ],
|
2023-03-28 15:23:01 +00:00
|
|
|
}@args:
|
2016-01-15 17:18:54 +00:00
|
|
|
|
2023-03-28 15:23:01 +00:00
|
|
|
let
|
|
|
|
loName = lib.toLower productShort;
|
|
|
|
hiName = lib.toUpper productShort;
|
|
|
|
vmoptsName = loName + lib.optionalString stdenv.hostPlatform.is64bit "64" + ".vmoptions";
|
2016-01-15 17:18:54 +00:00
|
|
|
in
|
|
|
|
|
2021-10-30 06:19:46 +00:00
|
|
|
with stdenv;
|
|
|
|
lib.makeOverridable mkDerivation (
|
|
|
|
rec {
|
2022-03-22 16:57:23 +00:00
|
|
|
inherit pname version src;
|
2023-03-28 15:23:01 +00:00
|
|
|
passthru.buildNumber = buildNumber;
|
2022-03-22 16:57:23 +00:00
|
|
|
meta = args.meta // {
|
|
|
|
mainProgram = pname;
|
|
|
|
};
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2016-01-15 17:18:54 +00:00
|
|
|
desktopItem = makeDesktopItem {
|
2022-03-22 16:57:23 +00:00
|
|
|
name = pname;
|
|
|
|
exec = pname;
|
2023-03-28 15:23:01 +00:00
|
|
|
comment = lib.replaceStrings [ "\n" ] [ " " ] meta.longDescription;
|
2016-01-15 17:18:54 +00:00
|
|
|
desktopName = product;
|
|
|
|
genericName = meta.description;
|
2022-02-22 14:56:15 +00:00
|
|
|
categories = [ "Development" ];
|
2022-03-22 16:57:23 +00:00
|
|
|
icon = pname;
|
2022-02-22 14:56:15 +00:00
|
|
|
startupWMClass = wmClass;
|
2016-01-15 17:18:54 +00:00
|
|
|
};
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2024-07-24 17:35:47 +00:00
|
|
|
vmoptsIDE = if hiName == "WEBSTORM" then "WEBIDE" else hiName;
|
2023-01-21 22:06:40 +00:00
|
|
|
vmoptsFile = lib.optionalString (vmopts != null) (writeText vmoptsName vmopts);
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2023-09-22 19:23:03 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
makeWrapper
|
|
|
|
patchelf
|
|
|
|
unzip
|
|
|
|
autoPatchelfHook
|
|
|
|
];
|
|
|
|
buildInputs = extraBuildInputs;
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2022-02-01 02:40:45 +00:00
|
|
|
postPatch = ''
|
2023-03-28 15:23:01 +00:00
|
|
|
rm -rf jbr
|
2023-07-10 21:46:04 +00:00
|
|
|
# When using the IDE as a remote backend using gateway, it expects the jbr directory to contain the jdk
|
|
|
|
ln -s ${jdk.home} jbr
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2023-07-14 20:10:59 +00:00
|
|
|
if [ -d "plugins/remote-dev-server" ]; then
|
2024-02-03 17:52:06 +00:00
|
|
|
patch -F3 -p1 < ${../patches/jetbrains-remote-dev.patch}
|
2023-07-14 20:10:59 +00:00
|
|
|
fi
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2023-09-28 18:04:03 +00:00
|
|
|
vmopts_file=bin/linux/${vmoptsName}
|
|
|
|
if [[ ! -f $vmopts_file ]]; then
|
|
|
|
vmopts_file=bin/${vmoptsName}
|
|
|
|
if [[ ! -f $vmopts_file ]]; then
|
|
|
|
echo "ERROR: $vmopts_file not found"
|
|
|
|
exit 1
|
2024-12-10 19:26:33 +00:00
|
|
|
fi
|
2023-09-28 18:04:03 +00:00
|
|
|
fi
|
|
|
|
echo -Djna.library.path=${
|
|
|
|
lib.makeLibraryPath ([
|
|
|
|
libsecret
|
|
|
|
e2fsprogs
|
|
|
|
libnotify
|
|
|
|
# Required for Help -> Collect Logs
|
|
|
|
# in at least rider and goland
|
|
|
|
udev
|
|
|
|
])
|
|
|
|
} >> $vmopts_file
|
2016-01-15 17:18:54 +00:00
|
|
|
'';
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2016-01-15 17:18:54 +00:00
|
|
|
installPhase = ''
|
2021-07-03 07:20:31 +00:00
|
|
|
runHook preInstall
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2023-09-22 19:23:03 +00:00
|
|
|
mkdir -p $out/{bin,$pname,share/pixmaps,share/icons/hicolor/scalable/apps}
|
2022-03-22 16:57:23 +00:00
|
|
|
cp -a . $out/$pname
|
2022-11-04 20:45:20 +00:00
|
|
|
[[ -f $out/$pname/bin/${loName}.png ]] && ln -s $out/$pname/bin/${loName}.png $out/share/pixmaps/${pname}.png
|
2023-06-26 18:33:58 +00:00
|
|
|
[[ -f $out/$pname/bin/${loName}.svg ]] && ln -s $out/$pname/bin/${loName}.svg $out/share/pixmaps/${pname}.svg \
|
|
|
|
&& ln -s $out/$pname/bin/${loName}.svg $out/share/icons/hicolor/scalable/apps/${pname}.svg
|
2023-09-22 19:23:03 +00:00
|
|
|
cp ${libdbm}/lib/libdbm.so $out/$pname/bin/libdbm.so
|
|
|
|
cp ${fsnotifier}/bin/fsnotifier $out/$pname/bin/fsnotifier
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2016-01-15 17:18:54 +00:00
|
|
|
jdk=${jdk.home}
|
|
|
|
item=${desktopItem}
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2024-08-17 12:51:35 +00:00
|
|
|
launcher="$out/$pname/bin/${loName}"
|
|
|
|
if [ -e "$launcher" ]; then
|
|
|
|
rm "$launcher".sh # We do not wrap the old script-style launcher anymore.
|
|
|
|
else
|
|
|
|
launcher+=.sh
|
|
|
|
fi
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2024-08-17 12:51:35 +00:00
|
|
|
wrapProgram "$launcher" \
|
2023-09-22 19:23:03 +00:00
|
|
|
--prefix PATH : "${
|
|
|
|
lib.makeBinPath [
|
|
|
|
jdk
|
|
|
|
coreutils
|
|
|
|
gnugrep
|
|
|
|
which
|
|
|
|
git
|
|
|
|
]
|
|
|
|
}" \
|
2023-10-26 22:43:36 +00:00
|
|
|
--suffix PATH : "${lib.makeBinPath [ python3 ]}" \
|
2023-09-28 18:04:03 +00:00
|
|
|
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath extraLdPath}" \
|
2021-10-09 21:20:30 +00:00
|
|
|
${lib.concatStringsSep " " extraWrapperArgs} \
|
2022-02-08 14:32:29 +00:00
|
|
|
--set-default JDK_HOME "$jdk" \
|
|
|
|
--set-default ANDROID_JAVA_HOME "$jdk" \
|
|
|
|
--set-default JAVA_HOME "$jdk" \
|
2024-06-19 12:14:05 +00:00
|
|
|
--set-default JETBRAINS_CLIENT_JDK "$jdk" \
|
2023-08-01 17:40:49 +00:00
|
|
|
--set-default ${hiName}_JDK "$jdk" \
|
2024-06-23 19:37:17 +00:00
|
|
|
--set-default LOCALE_ARCHIVE "${glibcLocales}/lib/locale/locale-archive" \
|
2024-07-24 17:35:47 +00:00
|
|
|
--set-default ${vmoptsIDE}_VM_OPTIONS ${vmoptsFile}
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2024-08-17 12:51:35 +00:00
|
|
|
ln -s "$launcher" $out/bin/$pname
|
2023-09-22 19:23:03 +00:00
|
|
|
rm -rf $out/$pname/plugins/remote-dev-server/selfcontained/
|
2023-07-14 20:10:59 +00:00
|
|
|
echo -e '#!/usr/bin/env bash\n'"$out/$pname/bin/remote-dev-server.sh"' "$@"' > $out/$pname/bin/remote-dev-server-wrapped.sh
|
|
|
|
chmod +x $out/$pname/bin/remote-dev-server-wrapped.sh
|
|
|
|
ln -s "$out/$pname/bin/remote-dev-server-wrapped.sh" $out/bin/$pname-remote-dev-server
|
2016-01-15 17:18:54 +00:00
|
|
|
ln -s "$item/share/applications" $out/share
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2021-07-03 07:20:31 +00:00
|
|
|
runHook postInstall
|
2016-01-15 17:18:54 +00:00
|
|
|
'';
|
2021-01-15 13:21:58 +00:00
|
|
|
}
|
|
|
|
// lib.optionalAttrs (!(meta.license.free or true)) {
|
2019-09-12 20:22:31 +00:00
|
|
|
preferLocalBuild = true;
|
2021-10-30 06:19:46 +00:00
|
|
|
}
|
|
|
|
)
|