forked from mirrors/nixpkgs
signald: reduce closure size by switching to a custom JRE bundle
This effectively reduces the size of the runtime closure by ~79%: $ nix path-info ./result-old -Sh /nix/store/9ggmj6fmqszfvd0lg2im7qssscql0jac-signald-0.15.0 729.0M $ nix path-info ./result -Sh /nix/store/z9bfj547j9fkyl8g0mqb1n108s7zw4w5-signald-0.15.0 155.2M Similar change as 2f9426ad8312101f4e84bcc4e28860695d28005f: newer Java versions don't support a "traditional" JRE anymore, but it's possible to create dedicated runtime environments using `jlink`[1]. [1] https://medium.com/azulsystems/using-jlink-to-build-java-runtimes-for-non-modular-applications-9568c5e70ef4 Closes #150493
This commit is contained in:
parent
7372d298cd
commit
e78bdc683c
|
@ -1,5 +1,5 @@
|
|||
{ lib, stdenv, fetchurl, fetchFromGitLab, jdk17_headless, coreutils, gradle_6, git, perl
|
||||
, makeWrapper, fetchpatch, substituteAll
|
||||
, makeWrapper, fetchpatch, substituteAll, jre_minimal
|
||||
}:
|
||||
|
||||
let
|
||||
|
@ -13,6 +13,25 @@ let
|
|||
sha256 = "sha256-2cb1pyBOoOlFqJsNKXA0Q9x4wCE4yzzcfrDDtTp7HMk=";
|
||||
};
|
||||
|
||||
jre' = jre_minimal.override {
|
||||
jdk = jdk17_headless;
|
||||
# from https://gitlab.com/signald/signald/-/blob/0.18.5/build.gradle#L173
|
||||
modules = [
|
||||
"java.base"
|
||||
"java.management"
|
||||
"java.naming"
|
||||
"java.sql"
|
||||
"java.xml"
|
||||
"jdk.crypto.ec"
|
||||
"jdk.httpserver"
|
||||
|
||||
# for java/beans/PropertyChangeEvent
|
||||
"java.desktop"
|
||||
# for sun/misc/Unsafe
|
||||
"jdk.unsupported"
|
||||
];
|
||||
};
|
||||
|
||||
# fake build to pre-download deps into fixed-output derivation
|
||||
deps = stdenv.mkDerivation {
|
||||
pname = "${pname}-deps";
|
||||
|
@ -67,7 +86,7 @@ in stdenv.mkDerivation rec {
|
|||
tar xvf ./build/distributions/signald.tar --strip-components=1 --directory $out/
|
||||
wrapProgram $out/bin/signald \
|
||||
--prefix PATH : ${lib.makeBinPath [ coreutils ]} \
|
||||
--set JAVA_HOME "${jdk17_headless}"
|
||||
--set JAVA_HOME "${jre'}"
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
|
Loading…
Reference in a new issue