From 00fd486d49170b1304c67381b3096e55d4cdc76f Mon Sep 17 00:00:00 2001 From: Rudi Floren Date: Thu, 24 Oct 2024 23:53:40 +0200 Subject: [PATCH] resolve TempDir paths before passing them to the flake bin On MacOS /tmp is a symlink to /private/tmp. TempDir creates a dir and returns the path as /tmp. nix is unhappy with symlink dirs when calling nix flake metadata --json To fix this we canonicalize the path first, resolving any symlinks on the way. Fixes #190. --- src/nix/hive/assets.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/nix/hive/assets.rs b/src/nix/hive/assets.rs index 29eba43..9e1f154 100644 --- a/src/nix/hive/assets.rs +++ b/src/nix/hive/assets.rs @@ -51,7 +51,10 @@ impl Assets { // We explicitly specify `path:` instead of letting Nix resolve // automatically, which would involve checking parent directories // for a git repository. - let uri = format!("path:{}", temp_dir.path().to_str().unwrap()); + let uri = format!( + "path:{}", + temp_dir.path().canonicalize().unwrap().to_str().unwrap() + ); let _ = lock_flake_quiet(&uri).await; let assets_flake = Flake::from_uri(uri).await?; assets_flake_uri = Some(assets_flake.locked_uri().to_owned());