-
Notifications
You must be signed in to change notification settings - Fork 841
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stack does not follow the XDG Base Directory Specification #4243
Comments
If you can add an option to change the directory structure, that would be great |
Just thinking about how this should behave, maybe if |
I would find this helpful — I want to keep down the size of my backups, and so I currently have to manually delete caches. The |
@borsboom Yes, that sounds sensible. We wouldn't want to copy the cache automatically when invoking stack, as it may be very large, so it should keep using the available @dbaynard Correct me if I'm wrong, but the |
It does fall in that category, and should therefore be in I'm trying to get a handle on how much work would be involved in a PR, and which other parts of the code would be impacted. @rszibele would you be able to take a look? |
Also, you've listed backups as a reason for this change. Are there others? I've reproduced the justification from the base directory specification you linked, here.
|
@dbaynard I'll have to take an in-depth look at how much has to be changed and how the global project works. From a quick overall glance at the code base we have a few options: 1. The easy way with as few modifications as possible:
2. The clean solution with a lot more modifications:
Stack already uses the I'd prefer the clean solution from a code perspective, but the first one would work equally as well from a practical standpoint and it also should make the global project work as-is without any extra modifications. I'm currently working on an experimental tool to generate Flatpak manifests from stack projects to allow easy distribution of Haskell binaries on GNU/Linux, so it could take a bit before I can look into this in more depth. The main reason is backups and the ability to easily delete cache without knowing the internals of a program or excluding directories manually from backup scripts. Thankfully a lot of projects (new and old: KDE, GNOME, Chromium, Blender, GIMP 2.10, and many more) are supporting the XDG Base Directory specification. I really hope XDG becomes the gold standard on GNU/Linux instead of the old |
That looks great @rszibele! I agree on XDG; it's good to have these reasons explicit, here. Do note that there are some major changes to stack's caching behaviour (e.g. #4254, #3922) in progress. It seems like this change should be orthogonal. It would be very good to make this change at the same time. @snoyberg is driving those changes. |
I would also love to see this change, just to throw my 10c (and support) in to the conversation. The "standard" of just throwing everything in to |
I just want to point out a misunderstanding about the XDG_* environment variables. As specified in the XDG Base Directory Specification, the XDG_* environment variable don't have to be set. Setting the XDG_* environment variable is just a way to override their default values :
It's really important to understand that you MUST NOT expect the XDG_* environment variables to be set to handle the XDG Base directories default locations. It may be obvious for many of yours, but I just wanted to point it out as many softwares pretending to support the XDG Base Directory Specification expect those environment variables to be set. This results in your home directory being cluttered because those variables are not set by the linux distributions nor the shell (because they don't have to) and make this spec useless. To briefly show the expected behavior, look at the shell script example below: readonly config_dir="${XDG_CONFIG_HOME:-$HOME/.config}/stack" To fully understand this spec, please read it. |
Just thinking about something while writing my previous comment. Stack has a configuration file for each project and another one for the global project. This file may be located at I don't say there is a need for it. But while rewriting the configuration files loading mechanism, it may be useful to add this feature. What do you think about it ? |
Do you mean, a So,
|
Arf. I just saw there is already a global non-project configuration file located at |
Two things:
|
@dbaynard Unfortunately, I'm unable to allocate any time to this issue at the moment. I'm currently caught up in a commercial project that I'm expecting to ship this June/July (if all goes well). |
Pandoc has recently done this (see jgm/pandoc#3582). It would be nice to get this for the next major release. |
Closing, having added to the wishlist. PRs welcome! |
Stack is one of my favorite build tools and unfortunately it currently does not follow the XDG Base Directory Specification: https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
My
$HOME/.stack
folder is currently sitting at around 12GiB (most of which is cache), which requires me to manually check which files I have to back up.From a quick glance the following files are configuration which would belong in
$XDG_CONFIG_HOME/stack
:$HOME/.stack/config.yaml
$HOME/.stack/global-project/stack.yaml
The files in
$HOME/.stack/templates/
probably belong in$XDG_DATA_HOME/stack/templates/
, as the user could have his own and therefore could be considered essential.The other directories seem to only contain cache data which are non-essential and would belong in
$XDG_CACHE_HOME/stack
.The text was updated successfully, but these errors were encountered: