diff --git a/pkgs/development/compilers/jetbrains-jdk/default.nix b/pkgs/development/compilers/jetbrains-jdk/default.nix index 5a77429741b3..0c7f088a5f2f 100644 --- a/pkgs/development/compilers/jetbrains-jdk/default.nix +++ b/pkgs/development/compilers/jetbrains-jdk/default.nix @@ -9,6 +9,7 @@ , unzip , rsync , debugBuild ? false +, withJcef ? true , libXdamage , libXxf86vm @@ -29,6 +30,8 @@ # TODO respect $NIX_BUILD_CORES +assert debugBuild -> withJcef; + let arch = { "aarch64-linux" = "aarch64"; @@ -37,7 +40,7 @@ let cpu = stdenv.hostPlatform.parsed.cpu.name; in openjdk17.overrideAttrs (oldAttrs: rec { - pname = "jetbrains-jdk-jcef"; + pname = "jetbrains-jdk" + lib.optionalString withJcef "-jcef"; javaVersion = "17.0.8"; build = "1000.8"; # To get the new tag: @@ -61,13 +64,12 @@ openjdk17.overrideAttrs (oldAttrs: rec { patches = [ ]; - # Configure is done in build phase - configurePhase = "true"; + dontConfigure = true; buildPhase = '' runHook preBuild - cp -r ${jetbrains.jcef} jcef_linux_${arch} + ${lib.optionalString withJcef "cp -r ${jetbrains.jcef} jcef_linux_${arch}"} sed \ -e "s/OPENJDK_TAG=.*/OPENJDK_TAG=${openjdkTag}/" \ @@ -81,7 +83,7 @@ openjdk17.overrideAttrs (oldAttrs: rec { -i jb/project/tools/linux/scripts/mkimages_${arch}.sh patchShebangs . - ./jb/project/tools/linux/scripts/mkimages_${arch}.sh ${build} ${if debugBuild then "fd" else "jcef"} + ./jb/project/tools/linux/scripts/mkimages_${arch}.sh ${build} ${if debugBuild then "fd" else (if withJcef then "jcef" else "nomod")} runHook postBuild ''; @@ -90,7 +92,7 @@ openjdk17.overrideAttrs (oldAttrs: rec { let buildType = if debugBuild then "fastdebug" else "release"; debugSuffix = if debugBuild then "-fastdebug" else ""; - jcefSuffix = if debugBuild then "" else "_jcef"; + jcefSuffix = if debugBuild || !withJcef then "" else "_jcef"; jbrsdkDir = "jbrsdk${jcefSuffix}-${javaVersion}-linux-${arch}${debugSuffix}-b${build}"; in '' @@ -100,7 +102,7 @@ openjdk17.overrideAttrs (oldAttrs: rec { mv build/linux-${cpu}-server-${buildType}/images/${jbrsdkDir} build/linux-${cpu}-server-${buildType}/images/jdk '' + oldAttrs.installPhase + "runHook postInstall"; - postInstall = '' + postInstall = lib.optionalString withJcef '' chmod +x $out/lib/openjdk/lib/chrome-sandbox ''; diff --git a/pkgs/development/compilers/jetbrains-jdk/jcef.nix b/pkgs/development/compilers/jetbrains-jdk/jcef.nix index 893f43f7ec8e..6b688e32ba50 100644 --- a/pkgs/development/compilers/jetbrains-jdk/jcef.nix +++ b/pkgs/development/compilers/jetbrains-jdk/jcef.nix @@ -74,23 +74,23 @@ let ]; buildType = if debugBuild then "Debug" else "Release"; -platform = { - "aarch64-linux" = "linuxarm64"; - "x86_64-linux" = "linux64"; -}.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}"); -arches = { - "linuxarm64" = { - depsArch = "arm64"; - projectArch = "arm64"; - targetArch = "arm64"; - }; - "linux64" = { - depsArch = "amd64"; - projectArch = "x86_64"; - targetArch = "x86_64"; - }; -}.${platform}; -inherit (arches) depsArch projectArch targetArch; + platform = { + "aarch64-linux" = "linuxarm64"; + "x86_64-linux" = "linux64"; + }.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}"); + arches = { + "linuxarm64" = { + depsArch = "arm64"; + projectArch = "arm64"; + targetArch = "arm64"; + }; + "linux64" = { + depsArch = "amd64"; + projectArch = "x86_64"; + targetArch = "x86_64"; + }; + }.${platform}; + inherit (arches) depsArch projectArch targetArch; in stdenv.mkDerivation rec { @@ -110,18 +110,20 @@ stdenv.mkDerivation rec { inherit rev; hash = "sha256-8zsgcWl0lZtC1oud5IlkUdeXxJUlHoRfw8t0FrZUQec="; }; - cef-bin = let + cef-bin = + let # `cef_binary_${CEF_VERSION}_linux64_minimal`, where CEF_VERSION is from $src/CMakeLists.txt - name = "cef_binary_111.2.1+g870da30+chromium-111.0.5563.64_${platform}_minimal"; - hash = { - "linuxarm64" = "sha256-gCDIfWsysXE8lHn7H+YM3Jag+mdbWwTQpJf0GKdXEVs="; - "linux64" = "sha256-r+zXTmDN5s/bYLvbCnHufYdXIqQmCDlbWgs5pdOpLTw="; - }.${platform}; - urlName = builtins.replaceStrings ["+"] ["%2B"] name; - in fetchzip { - url = "https://cef-builds.spotifycdn.com/${urlName}.tar.bz2"; - inherit name hash; - }; + name = "cef_binary_111.2.1+g870da30+chromium-111.0.5563.64_${platform}_minimal"; + hash = { + "linuxarm64" = "sha256-gCDIfWsysXE8lHn7H+YM3Jag+mdbWwTQpJf0GKdXEVs="; + "linux64" = "sha256-r+zXTmDN5s/bYLvbCnHufYdXIqQmCDlbWgs5pdOpLTw="; + }.${platform}; + urlName = builtins.replaceStrings [ "+" ] [ "%2B" ] name; + in + fetchzip { + url = "https://cef-builds.spotifycdn.com/${urlName}.tar.bz2"; + inherit name hash; + }; clang-fmt = fetchurl { url = "https://storage.googleapis.com/chromium-clang-format/dd736afb28430c9782750fc0fd5f0ed497399263"; hash = "sha256-4H6FVO9jdZtxH40CSfS+4VESAHgYgYxfCBFSMHdT0hE="; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index bb9b72a8e559..f088ad4bb91b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -32131,6 +32131,7 @@ with pkgs; vmopts = config.jetbrains.vmopts or null; jdk = jetbrains.jdk; }) // { + jdk-no-jcef = callPackage ../development/compilers/jetbrains-jdk { withJcef = false; }; jdk = callPackage ../development/compilers/jetbrains-jdk { }; jcef = callPackage ../development/compilers/jetbrains-jdk/jcef.nix { }; });