pixi icon indicating copy to clipboard operation
pixi copied to clipboard

pixi not searching for XDG_CONFIG_HOME again

Open ickc opened this issue 1 year ago • 12 comments

Checks

  • [x] I have checked that this issue has not already been reported.

  • [x] I have confirmed this bug exists on the latest version of pixi, using pixi --version.

Reproducible example

% cat $XDG_CONFIG_HOME/pixi/config.toml
change-ps1 = false
% pixi shell
(environment-name-here)

Issue description

According to the doc, pixi no longer search for $XDG_CONFIG_HOME nor $HOME/.config on macOS:

These past issue/discussion seem to indicate they are intended to be supported:

  • #1037
  • #1049

Lastly, using the latest pixi v0.46.0 on from conda-forge confirms this behavior (that it ignores $XDG_CONFIG_HOME on macOS but fine on Linux).

Expected behavior

It should continues to respect XDG_CONFIG_HOME. The support of macOS specific config dir in $HOME/Library/Application Support/pixi/config.toml is fine, but UNIX users might want to stick to XDG_CONFIG_HOME. Search priority is up to discussion.

ickc avatar May 13 '25 11:05 ickc

I see that we changed that, Pixi now relies on the standards given by dirs.

XDG is not a MacOS standard. @pavelzw @chawyehsu I don't recall why it was removed. But I'm hasitant to reintroduce it, what do you think?

ruben-arts avatar May 13 '25 12:05 ruben-arts

was it removed? I thought it was never supported by pixi: https://github.com/prefix-dev/pixi/issues/276

i personally think it's a nice standard and even though macOS doesn't adhere to it, i would like to see it. in pixi's docs you also don't see any mention of XDG_CONFIG_HOME on macOS: https://pixi.sh/latest/reference/pixi_configuration/

i personally would like to see it as well on macOS even if it's technically not a standard

pavelzw avatar May 13 '25 12:05 pavelzw

XDG is not a MacOS standard.

Surprisingly I talked about it days ago.. https://x.com/chawyehsu/status/1921105137193406797

Pixi now relies on the standards given by dirs.

dirs/directories crates are good though they don't have well support for XDG spec (They do have support but only on Linux, no on Unix/macOS/Windows)

I don't recall why it was removed.

I haven't tracked the evolution of pixi since my last contribution, but IIRC pixi did have the support (and seems it was implemented by me ;P)

in pixi's docs you also don't see any mention of XDG_CONFIG_HOME on macOS

The old docs of pixi does mention it, ~IIRC~. Yep

chawyehsu avatar May 13 '25 12:05 chawyehsu

P.S. a few minutes ago there's already a PR and if that's merged that we don't need to discuss further below...

XDG is not a MacOS standard.

This is not an accurate statement. You may say Apple does not adhere to the XDG Base Directory Specification, and macOS is agnostic to it. However,

Freedesktop.org is a project to work on interoperability and shared base technology for free-software desktop environments for the X Window System (X11) and Wayland on Linux and other Unix-like operating systems.

UNIX-like operation systems including macOS is a platform where developers can implement the XDG Base Directory Specification.

I concur however that it is increasingly a trend for libraries to pick up the macOS-native way to put things under ~/Library/Application Support/.

But, consider that

  • If the environment has XDG_CONFIG_HOME defined on macOS, while macOS is agnostic to what it is (a.k.a. macOS don't support it), then it means that there's only one possible reason the user define it (as macOS don't support it). And it would be good UX to respect the user's choice (where many other UNIX tools continue to adhere to that on macOS) than to ignore it.
  • pixi is designed to be cross-platform in mind. If pixi recognized XDG_CONFIG_HOME, it would makes people deploying pixi to multi-platform systems simpler.

Finally, the practical concern / side effect of not supporting that on macOS is, by looking at the diff between these table:

https://pixi.sh/latest/reference/pixi_configuration/#__tabbed_1_1

https://pixi.sh/latest/reference/pixi_configuration/#__tabbed_1_2

the only absolute path that is user customizable is PIXI_HOME, but the user may not want to put the config there (e.g. by supporting multiple PIXI_HOME containing different pixi binary versions or archs).

If you absolutely do not want to support XDG_CONFIG_HOME on macOS, then I would suggest adding PIXI_CONFIG to allow people to specify the path to config.toml (where I would actually set PIXI_CONFIG="${XDG_CONFIG_HOME}/pixi/config.toml").

ickc avatar May 13 '25 13:05 ickc

Wrote a little more extended reproducible example:

  1. Choose a folder for XDG_CONFIG_HOME, example: /my/path/oss
  2. Create a file in /my/path/oss/pixi/config.toml with shell.change-ps1 = false
  3. run XDG_CONFIG_HOME=/my/path/oss/pixi/config.toml pixi shell

You should still see the shell prompt string.

ethe xpected result is no prompt string present

nichtmacho avatar May 18 '25 18:05 nichtmacho

If the environment has XDG_CONFIG_HOME defined on macOS, while macOS is agnostic to what it is (a.k.a. macOS don't support it), then it means that there's only one possible reason the user define it (as macOS don't support it). And it would be good UX to respect the user's choice (where many other UNIX tools continue to adhere to that on macOS) than to ignore it.

The same goes to Windows.

chawyehsu avatar May 19 '25 14:05 chawyehsu

The same goes to Windows.

Is Windows UNIX-like? Would it be a common practice to share rc files between Windows and UNIX-like operating systems?

ickc avatar May 19 '25 14:05 ickc

Is Windows UNIX-like?

No. But OS polyglot / cross-platform user would love to organize their dotfiles based on the XDG spec and share them across operating systems, simpler and easier. I mean, XDG_CONFIG_HOME is undefined by default on these OSes, for single-platform user rc files are stored following the OS standard spec. There is no drawback in supporting XDG spec on Windows as well.

chawyehsu avatar May 19 '25 15:05 chawyehsu

I mean, XDG_CONFIG_HOME is undefined by default on these OSes, for single-platform user rc files are stored following the OS standard spec. There is no drawback in supporting XDG spec on Windows as well.

Hm... I see where you're coming from. I'm not sure as I don't use Windows. Is there example softwares that people are supporting XDG spec on Windows? (Even if it is unintentional.)

I ask so because it is very common for command line programs to support the XDG spec, even unintentionally when they didn't give a thought about Apple's standard. So to a mac user it is often a surprise when the "XDG spec didn't just work". But I suspect no windows user would find it a surprise if it ain't respected even if the user specified it?

ickc avatar May 19 '25 16:05 ickc

very common for command line programs to support the XDG spec

Yeah, basically 90 percent are relevant to CLI apps.

Is there example softwares that people are supporting XDG spec on Windows? (Even if it is unintentional.)

Like the essential one: git on Windows, and GitHub's CLI tool gh, both intentional.

chawyehsu avatar May 19 '25 16:05 chawyehsu

I'm glad that my comment sparked a discussion here! Do you think it is worth documenting a little more XDG configuration variable in our docs?

nichtmacho avatar May 20 '25 08:05 nichtmacho

Do you think it is worth documenting a little more XDG configuration variable in our docs?

I believe only when you consider reintroducing XDG support on WIndows/UNIX in pixi.

chawyehsu avatar May 22 '25 09:05 chawyehsu