From d1983bbdff49902bde41d7ff020db257438044a6 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Wed, 6 Nov 2024 09:47:44 -0500 Subject: [PATCH] Don't try to use the netrc if itdoesn't exist --- magic-nix-cache/src/main.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/magic-nix-cache/src/main.rs b/magic-nix-cache/src/main.rs index 97ae9c9..9a2b9b2 100644 --- a/magic-nix-cache/src/main.rs +++ b/magic-nix-cache/src/main.rs @@ -313,7 +313,14 @@ async fn main_cli() -> Result<()> { } // When determinate-nixd is not available, but the user specified a netrc - (_, Some(path), Dnixd::Missing) => Some(FlakeHubAuthSource::Netrc(path.to_owned())), + (_, Some(path), Dnixd::Missing) => { + if path.exists() { + Some(FlakeHubAuthSource::Netrc(path.to_owned())) + } else { + tracing::debug!(path = %path.display(), "User-provided netrc does not exist"); + None + } + } // User explicitly turned on flakehub cache, but we have no netrc and determinate-nixd is not present (CacheTrinary::Enabled, None, Dnixd::Missing) => {