Change:
<ins> { stdenv, lib, fetchurl, file, glib, libxml2, libav_0_8, ffmpeg, libxslt , mesa_noglu , xorg, alsaLib, fontconfig, freetype, pango, gtk2, cairo , gdk_pixbuf, atk }: # TODO: Investigate building from source instead of patching binaries. # TODO: Binary patching for not just x86_64-linux but also x86_64-darwin i686-linux let drv = stdenv.mkDerivation rec { pname = "jetbrainsjdk"; version = "152b970.2"; name = pname + "-" + version; src = if stdenv.system == "x86_64-linux" then fetchurl { url = "https://bintray.com/jetbrains/intellij-jdk/download_file?file_path=jbsdk8u${version}_linux_x64.tar.gz"; sha256 = "0i2cqjfab91kr618z88nb5g9yg60j5z08wjl0nlvcmpvg2z6va0m"; } else abort "unsupported system: ${stdenv.system}"; nativeBuildInputs = [ file ]; unpackCmd = "mkdir jdk; pushd jdk; tar -xzf $src; popd"; installPhase = '' cd .. exes=$(file $sourceRoot/bin/* $sourceRoot/jre/bin/* 2> /dev/null | grep -E 'ELF.*(executable|shared object)' | sed -e 's/: .*$//') for file in $exes; do paxmark m "$file" done mv $sourceRoot $out jrePath=$out/jre ''; postFixup = let arch = "amd64"; rSubPaths = [ "lib/${arch}/jli" "lib/${arch}/server" "lib/${arch}/xawt" "lib/${arch}" ]; in '' rpath+="''${rpath:+:}${stdenv.lib.concatStringsSep ":" (map (a: "$jrePath/${a}") rSubPaths)}" find $out -type f -perm -0100  -exec patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)"  --set-rpath "$rpath" {} ; find $out -name "*.so" -exec patchelf --set-rpath "$rpath" {} ; ''; rpath = lib.makeLibraryPath ([ stdenv.cc.cc stdenv.cc.libc glib libxml2 libav_0_8 ffmpeg libxslt mesa_noglu alsaLib fontconfig freetype pango gtk2 cairo gdk_pixbuf atk ] ++ (with xorg; [ libX11 libXext libXtst libXi libXp libXt libXrender libXxf86vm ])); passthru.home = drv; meta = with stdenv.lib; { description = "An OpenJDK fork to better support Jetbrains's products."; longDescription = '' JetBrains Runtime is a runtime environment for running IntelliJ Platform based products on Windows, Mac OS X, and Linux. JetBrains Runtime is based on OpenJDK project with some modifications. These modifications include: Subpixel Anti-Aliasing, enhanced font rendering on Linux, HiDPI support, ligatures, some fixes for native crashes not presented in official build, and other small enhancements. JetBrains Runtime is not a certified build of OpenJDK. Please, use at your own risk. ''; homepage = "https://bintray.com/jetbrains/intellij-jdk/"; licenses = licenses.gpl2; maintainers = with maintainers; [ edwtjo ]; platforms = with platforms; [ "x86_64-linux" ]; }; }; in drv </ins>

Discussion:
I initially in case it was something I was doing wrong, but as I wrote and tested I became convinced that the issue wasn't with Docker or using X in some way special, but with nixpkgs, most likely the openjdk. I have not tested in NixOS, but only using nixpkgs in Ubuntu 16.04. Characters in IntelliJ appear to randomly render - . Using Docker This will start the container This should be run inside the container Compare to which has a similar setup that this is based on, including an Ubuntu 16.04 base image but no nixpkgs, and works. Note that runs and performs some volume mounts, so please inspect before running if you are concerned. System: (NixOS: , Ubuntu/Fedora: , ...) Nix version: (run ) Nixpkgs version: (run ) Sandboxing enabled: (run )
(sorry if I'm pinging the wrong guys) I tried a build than the one packaged with nix in the same environment, and it resolved the issue, further leading support to the idea that something in the OpenJDK build included in nixpkgs is causing the problem. Steps to reproduce "fix": Zulu JDK .deb file linked above and install (e.g. in docker as root) sure (e.g. ) has set to the new JDK correctly - I hacked in the container to guarantee this, setting . as the normal user from as above. Run from another terminal to verify the right is being used. I'll plan to move ahead with my work using this workaround for now, but will note the commit that describes this issue in the above repo is .
Regarding step 2 in my last post, you can run directly (same directory as but not linked into path), which will run with the specified in the environment - doesn't work because it overwrites these variables
Related:
So, I know the IDEA guys have an OpenJDK fork. I wonder if they do things they rely on. I don't have a lot of time for this right now, unfortunately...
Not sure - but I'm sure I've used various flavors of the OpenJDK (including Zulu but also just standard Ubuntu builds) previously with the -noJDK version of IntelliJ without this issue. At least the linked issue above proposes some nix-oriented workarounds as well.

Getting a bit off topic, but I sort of like the idea of not depending on hardcoded version values for IntelliJ anyway - though they can be updated, the '' script is not run regularly or in an automated fashion as might be desired by a CI/CD system, so one is at the mercy of both JetBrains not keeping old versions up, and of nixpkgs not necessarily keeping up with the latest versions. Is there any sort of CI system for nixpkgs that could automatically run and generate a PR using the github command?
So, I know the IDEA guys have an OpenJDK fork. I wonder if they do things they rely on. I don't have a lot of time for this right now, unfortunately... Confirmed, font rendering on Linux is one of the reasons behind JetBrains JDK existence.
I'm getting what seems to be this exact same issue on 22.05 channel, and I am using the package for IDEA appears to mostly happen with italic font or bold+italic font, but sometimes other things too. Like in this breakpoint condition text box when you expand it the rendering becomes bugged even though it's fine when not expanded. Not expanded: ! Expanded: !