Skip to content

Commit

Permalink
resolve TempDir paths before passing them to the flake bin
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
valkum committed Oct 24, 2024
1 parent b0a62f2 commit 815328f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/nix/hive/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit 815328f

Please sign in to comment.