Darwin support
This commit is contained in:
parent
d4b3e8f2bb
commit
df64fb851a
70
flake.nix
70
flake.nix
|
@ -7,7 +7,12 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, utils }:
|
outputs = { self, nixpkgs, utils }:
|
||||||
utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" ] (system:
|
(utils.lib.eachSystem [
|
||||||
|
"x86_64-linux"
|
||||||
|
"aarch64-linux"
|
||||||
|
"x86_64-darwin"
|
||||||
|
"aarch64-darwin"
|
||||||
|
] (system:
|
||||||
let
|
let
|
||||||
sources = builtins.fromJSON (builtins.readFile ./sources.json);
|
sources = builtins.fromJSON (builtins.readFile ./sources.json);
|
||||||
buildAdoptLike = with import nixpkgs { system = system; };
|
buildAdoptLike = with import nixpkgs { system = system; };
|
||||||
|
@ -23,22 +28,29 @@
|
||||||
sha256 = value.sha256;
|
sha256 = value.sha256;
|
||||||
};
|
};
|
||||||
version = value.java_version;
|
version = value.java_version;
|
||||||
buildInputs = with pkgs; [
|
buildInputs = if pkgs.stdenv.isLinux then
|
||||||
alsa-lib
|
with pkgs; [
|
||||||
fontconfig
|
alsa-lib
|
||||||
freetype
|
fontconfig
|
||||||
stdenv.cc.cc.lib
|
freetype
|
||||||
xorg.libX11
|
stdenv.cc.cc.lib
|
||||||
xorg.libXext
|
xorg.libX11
|
||||||
xorg.libXi
|
xorg.libXext
|
||||||
xorg.libXrender
|
xorg.libXi
|
||||||
xorg.libXtst
|
xorg.libXrender
|
||||||
zlib
|
xorg.libXtst
|
||||||
];
|
zlib
|
||||||
nativeBuildInputs = with pkgs; [ autoPatchelfHook makeWrapper ];
|
]
|
||||||
|
else
|
||||||
|
[ ];
|
||||||
|
nativeBuildInputs = if pkgs.stdenv.isLinux then
|
||||||
|
with pkgs; [ autoPatchelfHook makeWrapper ]
|
||||||
|
else
|
||||||
|
[ ];
|
||||||
dontStrip = 1;
|
dontStrip = 1;
|
||||||
installPhase = ''
|
installPhase = if pkgs.stdenv.isLinux then ''
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
mv $sourceRoot $out
|
mv $sourceRoot $out
|
||||||
# jni.h expects jni_md.h to be in the header search path.
|
# jni.h expects jni_md.h to be in the header search path.
|
||||||
ln -s $out/include/linux/*_md.h $out/include/
|
ln -s $out/include/linux/*_md.h $out/include/
|
||||||
|
@ -69,11 +81,31 @@
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
'';
|
'' else if pkgs.stdenv.isDarwin then ''
|
||||||
preFixup = ''
|
cd ..
|
||||||
|
mv $sourceRoot $out
|
||||||
|
# jni.h expects jni_md.h to be in the header search path.
|
||||||
|
ln -s $out/Contents/Home/include/darwin/*_md.h $out/Contents/Home/include/
|
||||||
|
rm -rf $out/Home/demo
|
||||||
|
# Remove some broken manpages.
|
||||||
|
rm -rf $out/Home/man/ja*
|
||||||
|
ln -s $out/Contents/Home/* $out/
|
||||||
|
# Propagate the setJavaClassPath setup hook from the JDK so that
|
||||||
|
# any package that depends on the JDK has $CLASSPATH set up
|
||||||
|
# properly.
|
||||||
|
mkdir -p $out/nix-support
|
||||||
|
printWords ${setJavaClassPath} > $out/nix-support/propagated-build-inputs
|
||||||
|
# Set JAVA_HOME automatically.
|
||||||
|
cat <<EOF >> $out/nix-support/setup-hook
|
||||||
|
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi
|
||||||
|
EOF
|
||||||
|
'' else
|
||||||
|
(throw "Unsupported OS");
|
||||||
|
preFixup = if pkgs.stdenv.isLinux then ''
|
||||||
find "$out" -name libfontmanager.so -exec \
|
find "$out" -name libfontmanager.so -exec \
|
||||||
patchelf --add-needed libfontconfig.so {} \;
|
patchelf --add-needed libfontconfig.so {} \;
|
||||||
'';
|
'' else
|
||||||
|
"";
|
||||||
};
|
};
|
||||||
in with import nixpkgs { system = system; }; {
|
in with import nixpkgs { system = system; }; {
|
||||||
packages = {
|
packages = {
|
||||||
|
@ -92,5 +124,5 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
defaultPackage = self.packages.${system}.temurin.stable;
|
defaultPackage = self.packages.${system}.temurin.stable;
|
||||||
});
|
}));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue