From 661a80ac3bcd6757289b9be2a47a74f696cea4cc Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Thu, 26 Dec 2024 14:50:39 +0100 Subject: [PATCH] fix(tvix/nar-bridge): set FileSize to NarSize MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Nix and Lix both report this quite wrong when showing progress, they assume 0.00 MiB of download size: ``` these 3 derivations will be built: /nix/store/m6dkr67hk87lpcz9wv8f2mp2zrgsyfp9-nix-2.24.11.drv /nix/store/zcfi6vs0z18309asw8fpa9v3665av44v-niv-0.2.22.drv /nix/store/g4kvzrs1kk9i13vaa8q1r0y4hgsqsnlp-dev-env.drv these 112 paths will be fetched (0.00 MiB download, 2649.76 MiB unpacked): /nix/store/3qzlg8h5qc1slypy99aafdcgkzj6974h-OneTuple-0.4.2 /nix/store/pp4540rig52fnj66kz1kiaj1000ja9v0-QuickCheck-2.14.3 /nix/store/416aqss6p59w6v92127hkz04v0bclx21-StateVar-1.2.2 /nix/store/b5f93spm2cl9g6x73dnx7ns5irs739fz-aeson-2.1.2.1 /nix/store/nqnx6k6y103rargdz2gai2rmi389zn6n-aeson-pretty-0.8.10 /nix/store/11wc4s6a6qi98lxikacw746slhmj5dl7-ansi-terminal-1.0.2 /nix/store/yy7j66av9lwh3lvbxp1zv7572wb4l7dj-ansi-terminal-types-0.11.5 /nix/store/cn6m459cbacdwkvjllgy5hkzf045yc1g-appar-0.1.8 […] ``` For now, set FileSize to NarSize - it's not more wrong than it was before, Nix already supports content encoding for compression (via curl). Reported-On: https://git.lix.systems/lix-project/lix/issues/606 Change-Id: Ia53506ecf6678ad298f759c95a69feb441cbc26d Reviewed-on: https://cl.tvl.fyi/c/depot/+/12919 Reviewed-by: raitobezarius Autosubmit: flokli Tested-by: BuildkiteCI --- tvix/nar-bridge/src/narinfo.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tvix/nar-bridge/src/narinfo.rs b/tvix/nar-bridge/src/narinfo.rs index 448aebcd6..25022b89d 100644 --- a/tvix/nar-bridge/src/narinfo.rs +++ b/tvix/nar-bridge/src/narinfo.rs @@ -153,6 +153,10 @@ fn gen_narinfo_str(path_info: &PathInfo) -> String { path_info.nar_size, ); narinfo.url = &url; + + // Set FileSize to NarSize, as otherwise progress reporting in Nix looks very broken + narinfo.file_size = Some(narinfo.nar_size); + narinfo.to_string() }