From e64cbea504ab04d2bcb1563c331315a9b32f6e47 Mon Sep 17 00:00:00 2001 From: Guillaume Girol Date: Mon, 17 Nov 2025 12:00:00 +0000 Subject: [PATCH] matrix-tuwunel: drop reference to rustc Alternative to the below PR Closes: https://github.com/NixOS/nixpkgs/pull/462394 --- .../dont-record-compilation-flags.patch | 21 +++++++++++++++++++ pkgs/by-name/ma/matrix-tuwunel/package.nix | 9 ++++++++ 2 files changed, 30 insertions(+) create mode 100644 pkgs/by-name/ma/matrix-tuwunel/dont-record-compilation-flags.patch diff --git a/pkgs/by-name/ma/matrix-tuwunel/dont-record-compilation-flags.patch b/pkgs/by-name/ma/matrix-tuwunel/dont-record-compilation-flags.patch new file mode 100644 index 000000000000..2f35204c8f00 --- /dev/null +++ b/pkgs/by-name/ma/matrix-tuwunel/dont-record-compilation-flags.patch @@ -0,0 +1,21 @@ +commit be2b9e1992f5a7048fe011f4d48591dfcec927a8 +Author: Guillaume Girol +Date: Mon Nov 17 12:00:00 2025 +0000 + + make the macro recording conpilation flags a noop + + it records references to rustc which increases the size of the closure of tuwunel by 1.5 GB. + +diff --git a/src/macros/mod.rs b/src/macros/mod.rs +index b5c5b67d..86f4755b 100644 +--- a/src/macros/mod.rs ++++ b/src/macros/mod.rs +@@ -39,7 +39,7 @@ pub fn recursion_depth(args: TokenStream, input: TokenStream) -> TokenStream { + } + + #[proc_macro] +-pub fn rustc_flags_capture(args: TokenStream) -> TokenStream { rustc::flags_capture(args) } ++pub fn rustc_flags_capture(_args: TokenStream) -> TokenStream { TokenStream::default() } + + #[proc_macro] + pub fn rustc_version(args: TokenStream) -> TokenStream { rustc::version(args) } diff --git a/pkgs/by-name/ma/matrix-tuwunel/package.nix b/pkgs/by-name/ma/matrix-tuwunel/package.nix index c7f7d29978ed..d2915a8502d6 100644 --- a/pkgs/by-name/ma/matrix-tuwunel/package.nix +++ b/pkgs/by-name/ma/matrix-tuwunel/package.nix @@ -19,6 +19,7 @@ liburing, nixosTests, writeTextFile, + rustc-unwrapped, }: let rust-jemalloc-sys' = rust-jemalloc-sys.override { @@ -103,6 +104,12 @@ rustPlatform.buildRustPackage (finalAttrs: { rustPlatform.bindgenHook ]; + patches = [ + # reduce closure size by not storing a reference to rustc-unwrapped + # alternative to https://github.com/NixOS/nixpkgs/pull/462394 + ./dont-record-compilation-flags.patch + ]; + buildInputs = [ bzip2 zstd @@ -172,6 +179,8 @@ rustPlatform.buildRustPackage (finalAttrs: { }; }; + disallowedReferences = [ rustc-unwrapped ]; + meta = { description = "Matrix homeserver written in Rust, official successor to conduwuit"; homepage = "https://github.com/matrix-construct/tuwunel";