Fix jdk cross-compilation

This commit is contained in:
Simonas Kazlauskas
2023-02-23 21:48:51 +02:00
parent 0cedd21446
commit 1407a818f0
2 changed files with 20 additions and 2 deletions

View File

@@ -7,8 +7,8 @@
outputs = { flake-utils, nixpkgs, ... }:
let
overlay = final: prev: rec {
jdk-openhab = final.jdk11;
openhab = final.callPackage ./openhab.nix { inherit jdk-openhab; };
jdk-openhab = final.callPackage ./jdk.nix {};
openhab = final.callPackage ./openhab.nix { };
openhab-addons = final.callPackage ./openhab-addons.nix {};
};
pkgs = system: import nixpkgs { inherit system; overlays = [ overlay ]; };

18
jdk.nix Normal file
View File

@@ -0,0 +1,18 @@
{ buildPlatform, hostPlatform, jdk11, which, zip, buildPackages }:
if buildPlatform == hostPlatform
then jdk11
else (jdk11.override {
# libIDL does not compile in cross-compile scenarios.
enableGnome2 = false;
}).overrideAttrs (old: {
# lol, nixpkgs cant get pkgs right
# AUTOCONF = "${autoconf}/bin/autoconf";
nativeBuildInputs = old.nativeBuildInputs ++ [ which zip ];
depsBuildBuild = with buildPackages; [ stdenv.cc autoconf ];
configureFlags = old.configureFlags ++ [
"--with-jtreg=no"
"--disable-hotspot-gtest"
"--with-build-jdk=${buildPackages.jdk11}"
];
})