31 assert debugBuild -> withJcef;
36 "aarch64-linux" = "aarch64";
37 "x86_64-linux" = "x64";
39 .${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
40 cpu = stdenv.hostPlatform.parsed.cpu.name;
42 jdk.overrideAttrs (oldAttrs: rec {
43 pname = "jetbrains-jdk" + lib.optionalString withJcef "-jcef";
44 javaVersion = "21.0.4";
47 # git clone https://github.com/jetbrains/jetbrainsruntime
49 # git checkout jbr-release-${javaVersion}b${build}
50 # git log --simplify-by-decoration --decorate=short --pretty=short | grep "jbr-" --color=never | cut -d "(" -f2 | cut -d ")" -f1 | awk '{print $2}' | sort -t "-" -k 2 -g | tail -n 1 | tr -d ","
51 openjdkTag = "jbr-21.0.4+8";
52 version = "${javaVersion}-b${build}";
54 src = fetchFromGitHub {
56 repo = "JetBrainsRuntime";
58 hash = "sha256-YF5Z1A4qmD9Z4TE6f2i8wv9ZD+NqHGY5Q0oIVQiC3Bg=";
62 # run `git log -1 --pretty=%ct` in jdk repo for new value on update
63 SOURCE_DATE_EPOCH = 1726275531;
72 ${lib.optionalString withJcef "cp -r ${jetbrains.jcef} jcef_linux_${arch}"}
75 -e "s/OPENJDK_TAG=.*/OPENJDK_TAG=${openjdkTag}/" \
76 -e "s/SOURCE_DATE_EPOCH=.*//" \
77 -e "s/export SOURCE_DATE_EPOCH//" \
78 -i jb/project/tools/common/scripts/common.sh
79 configureFlags=$(echo $configureFlags | sed 's/--host=[^ ]*//')
80 sed -i "s|STATIC_CONF_ARGS|STATIC_CONF_ARGS \$configureFlags|" jb/project/tools/linux/scripts/mkimages_${arch}.sh
82 -e "s/create_image_bundle \"jb/#/" \
83 -e "s/echo Creating /exit 0 #/" \
84 -i jb/project/tools/linux/scripts/mkimages_${arch}.sh
87 ./jb/project/tools/linux/scripts/mkimages_${arch}.sh ${build} ${
88 if debugBuild then "fd" else (if withJcef then "jcef" else "nomod")
96 buildType = if debugBuild then "fastdebug" else "release";
97 debugSuffix = if debugBuild then "-fastdebug" else "";
98 jcefSuffix = if debugBuild || !withJcef then "" else "_jcef";
99 jbrsdkDir = "jbrsdk${jcefSuffix}-${javaVersion}-linux-${arch}${debugSuffix}-b${build}";
104 mv build/linux-${cpu}-server-${buildType}/images/jdk/man build/linux-${cpu}-server-${buildType}/images/${jbrsdkDir}
105 rm -rf build/linux-${cpu}-server-${buildType}/images/jdk
106 mv build/linux-${cpu}-server-${buildType}/images/${jbrsdkDir} build/linux-${cpu}-server-${buildType}/images/jdk
108 + oldAttrs.installPhase
109 + "runHook postInstall";
111 postInstall = lib.optionalString withJcef ''
112 chmod +x $out/lib/openjdk/lib/chrome-sandbox
115 dontStrip = debugBuild;
118 # Build the set of output library directories to rpath against
120 lib.makeLibraryPath [
138 for output in $outputs; do
139 if [ "$output" = debug ]; then continue; fi
140 LIBDIRS="$(find $(eval echo \$$output) -name \*.so\* -exec dirname {} \+ | sort -u | tr '\n' ':'):$LIBDIRS"
142 # Add the local library paths to remove dependencies on the bootstrap
143 for output in $outputs; do
144 if [ "$output" = debug ]; then continue; fi
145 OUTPUTDIR=$(eval echo \$$output)
146 BINLIBS=$(find $OUTPUTDIR/bin/ -type f; find $OUTPUTDIR -name \*.so\*)
147 echo "$BINLIBS" | while read i; do
148 patchelf --set-rpath "$LIBDIRS:$(patchelf --print-rpath "$i")" "$i" || true
149 patchelf --shrink-rpath "$i" || true
154 nativeBuildInputs = [
159 ] ++ oldAttrs.nativeBuildInputs;
162 description = "OpenJDK fork to better support Jetbrains's products";
164 JetBrains Runtime is a runtime environment for running IntelliJ Platform
165 based products on Windows, Mac OS X, and Linux. JetBrains Runtime is
166 based on OpenJDK project with some modifications. These modifications
167 include: Subpixel Anti-Aliasing, enhanced font rendering on Linux, HiDPI
168 support, ligatures, some fixes for native crashes not presented in
169 official build, and other small enhancements.
170 JetBrains Runtime is not a certified build of OpenJDK. Please, use at
173 homepage = "https://confluence.jetbrains.com/display/JBR/JetBrains+Runtime";
174 inherit (jdk.meta) license platforms mainProgram;
175 maintainers = with maintainers; [ edwtjo ];
177 broken = stdenv.hostPlatform.isDarwin;
180 passthru = oldAttrs.passthru // {
181 home = "${jetbrains.jdk}/lib/openjdk";