fix(tvix/cli): NIX_PATH contents are duplicated when -I is not passed

Fix a bug introduced in 2daa483249

When the -I or --extra-nix-path option is not passed, the cli will
interpret the contents of the NIX_PATH environment variable twice:
once as part of the env attribute of clap's derive macro, and again in a
custom nix_path function. The custom function implements the appending
behavior nix users likely expect (see commit mentioned above), so the
env attribute is dropped. The downside is that NIX_PATH is no longer
rendered in the cli's help text. We can reclaim this behavior if we want
to, but that's left for later.

Change-Id: I2c0939d9453ea1af73e9ec15e45b25bf035a7493
Reviewed-on: https://cl.tvl.fyi/c/depot/+/13207
Autosubmit: benjaminedwardwebb <benjaminedwardwebb@gmail.com>
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
This commit is contained in:
Ben Webb 2025-03-03 17:10:57 -06:00 committed by clbot
parent 42da189180
commit 0d5effa7a6

View file

@ -50,7 +50,7 @@ pub struct Args {
/// ///
/// This option may be given multiple times. Paths added through -I take precedence over /// This option may be given multiple times. Paths added through -I take precedence over
/// NIX_PATH. /// NIX_PATH.
#[clap(long = "extra-nix-path", short = 'I', env = "NIX_PATH", action = clap::ArgAction::Append)] #[clap(long = "extra-nix-path", short = 'I', action = clap::ArgAction::Append)]
pub extra_nix_paths: Option<Vec<String>>, pub extra_nix_paths: Option<Vec<String>>,
/// Print "raw" (unquoted) output. /// Print "raw" (unquoted) output.