-
Notifications
You must be signed in to change notification settings - Fork 376
Description
Problem
When pixi.toml is a symlink, pixi resolves it to the real file location and creates the .pixi/ directory relative to the target, not the symlink. This breaks common dotfiles management workflows where users symlink config files from a git repository to their home directory.
Minimal Reproduction
Setup:
# Create a dotfiles repo with pixi.toml
mkdir -p ~/dotfiles
cat > ~/dotfiles/pixi.toml << 'EOF'
[workspace]
name = "shell_env"
channels = ["conda-forge"]
platforms = ["linux-64"]
[dependencies]
python = "3.13.*"
ripgrep = "*"
EOF
# Symlink it to home directory
ln -s ~/dotfiles/pixi.toml ~/pixi.toml
# Auto-activate in bashrc
echo 'eval "$(pixi shell-hook 2>/dev/null)"' >> ~/.bashrcCurrent behavior:
$ source ~/.bashrc
$ echo $CONDA_PREFIX
/home/user/dotfiles/.pixi/envs/default # Points to dotfiles repoExpected behavior:
$ source ~/.bashrc
$ echo $CONDA_PREFIX
/home/user/.pixi/envs/default # Environment in home directoryWhy This Matters
Version controlling and syncing across machines
Current Workaround Issues
Users must either:
- Option 1: Keep
pixi.tomlas a real file + manually sync it to the dotfiles repo - Option 2: Accept that the environment lives in
~/dotfiles/.pixi/envs/default(breaks tools that expect~/.pixi/envs/default, harder to clean up)
Root Cause (AI assisted)
I used an AI tool to find this line, apologies if there is more nuance than this
The issue is in pixi_manifest/src/manifests/provenance.rs:65: Line/tag pinned view
pub fn absolute_path(&self) -> PathBuf {
dunce::canonicalize(self.path.clone()).unwrap_or(self.path.to_path_buf())
}dunce::canonicalize() always resolves symlinks to the real path, causing pixi to treat the dotfiles repo as the workspace root.
Additional Context
- Platform: Linux (but affects all platforms)
- Pixi version: 0.59.0
- Workaround: See reproduction above - requires keeping files in sync manually
I am somewhat aware that this "global environment" isn't exactly the goal of this project but this is really the only issue I am hitting when trying to switch from standard conda to pixi with this workflow.
Would appreciate any thoughts on the best approach! Happy to contribute a PR if there's consensus on the solution.