From 7372d298cdf5010058071a4e6f6bdb810ee151d7 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Fri, 20 May 2022 14:46:45 +0200 Subject: [PATCH 1/2] signald: 0.17.0 -> 0.18.5 ChangeLogs: * https://gitlab.com/signald/signald/-/blob/0.18.5/releases/0.18.0.md * https://gitlab.com/signald/signald/-/blob/0.18.5/releases/0.18.1.md * https://gitlab.com/signald/signald/-/blob/0.18.5/releases/0.18.2.md * https://gitlab.com/signald/signald/-/blob/0.18.5/releases/0.18.3.md * https://gitlab.com/signald/signald/-/blob/0.18.5/releases/0.18.4.md * https://gitlab.com/signald/signald/-/blob/0.18.5/releases/0.18.5.md --- ...g-during-gradle-build-inside-Nix-FOD.patch | 25 +++++++++----- .../0002-buildconfig-local-deps-fixes.patch | 33 ++++++++++++------- .../instant-messengers/signald/default.nix | 8 ++--- 3 files changed, 42 insertions(+), 24 deletions(-) diff --git a/pkgs/applications/networking/instant-messengers/signald/0001-Fetch-buildconfig-during-gradle-build-inside-Nix-FOD.patch b/pkgs/applications/networking/instant-messengers/signald/0001-Fetch-buildconfig-during-gradle-build-inside-Nix-FOD.patch index e23aded6d0e7..9e1578e6f1a1 100644 --- a/pkgs/applications/networking/instant-messengers/signald/0001-Fetch-buildconfig-during-gradle-build-inside-Nix-FOD.patch +++ b/pkgs/applications/networking/instant-messengers/signald/0001-Fetch-buildconfig-during-gradle-build-inside-Nix-FOD.patch @@ -1,17 +1,17 @@ -From 232c692240b9c52b95bd38ba7aecb11e7077cf31 Mon Sep 17 00:00:00 2001 +From 8ed5f3c9117e08f7c2e4e1e01c2eee501675049b Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Sat, 26 Feb 2022 12:33:13 +0100 Subject: [PATCH] Fetch buildconfig during gradle build inside Nix FOD --- - build.gradle | 5 +++++ - 1 file changed, 5 insertions(+) + build.gradle | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle -index cbb587f..3b06e80 100644 +index eaa6e0e..63c2947 100644 --- a/build.gradle +++ b/build.gradle -@@ -82,6 +82,9 @@ static String getVersion() { +@@ -83,6 +83,9 @@ static String getVersion() { repositories { maven {url "https://gitlab.com/api/v4/groups/6853927/-/packages/maven"} // https://gitlab.com/groups/signald/-/packages @@ -21,15 +21,22 @@ index cbb587f..3b06e80 100644 mavenCentral() } -@@ -102,6 +105,8 @@ dependencies { - implementation 'io.prometheus:simpleclient_httpserver:0.14.1' +@@ -104,6 +107,8 @@ dependencies { + implementation 'io.prometheus:simpleclient_httpserver:0.15.0' implementation 'com.squareup.okhttp3:logging-interceptor:4.9.3' - implementation 'io.sentry:sentry:5.6.1' + implementation 'io.sentry:sentry:5.7.3' + implementation 'com.github.gmazzo.buildconfig:com.github.gmazzo.buildconfig.gradle.plugin:3.0.3' + implementation 'org.jetbrains.kotlin:kotlin-scripting-jvm:1.4.31' testImplementation 'org.junit.jupiter:junit-jupiter:5.8.2' } +@@ -171,4 +176,4 @@ allprojects { + runtime { + options = ['--strip-java-debug-attributes', '--compress', '2', '--no-header-files', '--no-man-pages'] + modules = ['java.base', 'java.management', 'java.naming', 'java.sql', 'java.xml', 'jdk.crypto.ec', 'jdk.httpserver', 'java.desktop', 'jdk.unsupported'] +-} +\ No newline at end of file ++} -- -2.33.1 +2.36.0 diff --git a/pkgs/applications/networking/instant-messengers/signald/0002-buildconfig-local-deps-fixes.patch b/pkgs/applications/networking/instant-messengers/signald/0002-buildconfig-local-deps-fixes.patch index c5931238fe58..a6efeb4a44f1 100644 --- a/pkgs/applications/networking/instant-messengers/signald/0002-buildconfig-local-deps-fixes.patch +++ b/pkgs/applications/networking/instant-messengers/signald/0002-buildconfig-local-deps-fixes.patch @@ -1,19 +1,19 @@ -From 80277ce9e24d9efa8dfd6eb775187c823e0e528e Mon Sep 17 00:00:00 2001 +From f319e1db47ae1eeddb6021cafe7b4f8551a702d7 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Sat, 26 Feb 2022 12:36:15 +0100 Subject: [PATCH 2/2] buildconfig/local deps fixes --- - build.gradle | 20 ++++++++++++++++++-- - 1 file changed, 18 insertions(+), 2 deletions(-) + build.gradle | 26 ++++++++++++++++++-------- + 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/build.gradle b/build.gradle -index cbb587f..ad836cf 100644 +index eaa6e0e..9a2f4e2 100644 --- a/build.gradle +++ b/build.gradle -@@ -9,10 +9,21 @@ import org.gradle.nativeplatform.platform.internal.ArchitectureInternal - import org.gradle.nativeplatform.platform.internal.OperatingSystemInternal +@@ -10,11 +10,21 @@ import org.gradle.nativeplatform.platform.internal.ArchitectureInternal import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform + import org.gradle.nativeplatform.platform.internal.OperatingSystemInternal +buildscript { + repositories { @@ -28,13 +28,14 @@ index cbb587f..ad836cf 100644 + plugins { - id 'com.github.gmazzo.buildconfig' version '3.0.3' +- id 'org.beryx.runtime' version '1.12.7' id 'application' } +apply plugin: "com.github.gmazzo.buildconfig" compileJava.options.encoding = 'UTF-8' -@@ -82,7 +93,10 @@ static String getVersion() { +@@ -83,7 +93,10 @@ static String getVersion() { repositories { maven {url "https://gitlab.com/api/v4/groups/6853927/-/packages/maven"} // https://gitlab.com/groups/signald/-/packages @@ -46,15 +47,25 @@ index cbb587f..ad836cf 100644 } dependencies { -@@ -102,6 +116,8 @@ dependencies { - implementation 'io.prometheus:simpleclient_httpserver:0.14.1' +@@ -104,6 +117,8 @@ dependencies { + implementation 'io.prometheus:simpleclient_httpserver:0.15.0' implementation 'com.squareup.okhttp3:logging-interceptor:4.9.3' - implementation 'io.sentry:sentry:5.6.1' + implementation 'io.sentry:sentry:5.7.3' + implementation 'com.github.gmazzo.buildconfig:com.github.gmazzo.buildconfig.gradle.plugin:3.0.3' + implementation 'org.jetbrains.kotlin:kotlin-scripting-jvm:1.4.31' testImplementation 'org.junit.jupiter:junit-jupiter:5.8.2' } +@@ -167,8 +182,3 @@ allprojects { + } + } + } +- +-runtime { +- options = ['--strip-java-debug-attributes', '--compress', '2', '--no-header-files', '--no-man-pages'] +- modules = ['java.base', 'java.management', 'java.naming', 'java.sql', 'java.xml', 'jdk.crypto.ec', 'jdk.httpserver', 'java.desktop', 'jdk.unsupported'] +-} +\ No newline at end of file -- -2.33.1 +2.36.0 diff --git a/pkgs/applications/networking/instant-messengers/signald/default.nix b/pkgs/applications/networking/instant-messengers/signald/default.nix index 3f84c156f823..37c763d5a4b9 100644 --- a/pkgs/applications/networking/instant-messengers/signald/default.nix +++ b/pkgs/applications/networking/instant-messengers/signald/default.nix @@ -4,13 +4,13 @@ let pname = "signald"; - version = "0.17.0"; + version = "0.18.5"; src = fetchFromGitLab { owner = pname; repo = pname; rev = version; - sha256 = "sha256-eN6lEs6PuRczbzQZmGlNf6Ahp4FbWpA3EArlATEiZHU="; + sha256 = "sha256-2cb1pyBOoOlFqJsNKXA0Q9x4wCE4yzzcfrDDtTp7HMk="; }; # fake build to pre-download deps into fixed-output derivation @@ -35,8 +35,8 @@ let outputHashMode = "recursive"; # Downloaded jars differ by platform outputHash = { - x86_64-linux = "sha256-kZ25p+lIkOqNoFFBgJRYFcvKJenKICVa1PasaaEHmRA="; - aarch64-linux = "sha256-CbFNigp3R7ETX0uXv6PNuhDpmPc4sowbWmwZ+5txXQs="; + x86_64-linux = "sha256-q1gzauIL7aKalvPSfiK5IvkNkidCh+6jp5bpwxR+PZ0="; + aarch64-linux = "sha256-cM+7MaV0/4yAzobXX9FSdl/ZfLddwySayao96UdDgzk="; }.${stdenv.system} or (throw "Unsupported platform"); }; From e78bdc683c3e8d41d3b43a171e6788b2a0d74def Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Mon, 13 Dec 2021 00:45:49 +0100 Subject: [PATCH 2/2] 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 --- .../instant-messengers/signald/default.nix | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/networking/instant-messengers/signald/default.nix b/pkgs/applications/networking/instant-messengers/signald/default.nix index 37c763d5a4b9..e60a683a491d 100644 --- a/pkgs/applications/networking/instant-messengers/signald/default.nix +++ b/pkgs/applications/networking/instant-messengers/signald/default.nix @@ -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 '';