-
Notifications
You must be signed in to change notification settings - Fork 701
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
Allow v2-install
to copy executables instead of symlinking
#5628
Comments
Note that it may not be safe even if exes are copied, for example in the presence of data files |
Also what is your goal? Packaging/distribution, just freeing up space (#3333) or something else entirely? |
I often write small programs in Haskell for personal use, for experiments, and to understand Haskell better. I mess up cabal builds quite often, so I'd like a "reset button". I've been accustomed to removing Freeing up space is not a primary concern but I'd like to keep a safe way to clean up cache at hand. Rebuilding libraries in Hackage is ok but breaking (my) executables is not. I don't intend to distribute them (yet). |
Not needed anymore with v2-* :) Packages are now isolated and cannot interfere with each other anymore, so the only reason for deleting the store should be lack of disk space (well, or a corrupted store in case of a power failure in the middle of a build. see #5529) |
Nice to hear that. As an alternative to waiting for #3333, is there a way to un-cabalize a package so that the executable is independent of I tried |
@matil019 maybe the discussion/suggestions at #5551 (comment) could be of interest to you |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
My usecase is that when I build binaries inside a docker container, the symlinks are no longer visible to the outer container. https://gitlab.com/fommil/dotfiles/blob/master/bin/cabal-docker @hvr doh, I've minimised my original comment to avoid the distraction. |
This isn't really fixed right? Since "removing ~/.cabal/store is no longer safe, in contrary [sic] to be described in the user guide" (since some executables may depend on data files, as documented). Losing all the tooling one depends on by removing a cache directory is a big deal. Hopefully most binaries installed with the new (old) copy functionality will function after clobbering the store, but I really have no idea. |
@jberryman well, yes, this was pointed out right away in the first comment at #5628 (comment) that the best we can do at this point is to add support for copying instead of symlinking the executable (only). It's not clear how we can achieve the ideal goal of being able to "copy" executables out of the Nix-style store in a self-contained way no longer retaining any reference to the store in a portable way. The way the cabal spec works, it is currently IMO not possible to end up with completely self-contained executables when data-files/libexec/etc are involved. The next best thing we could do however is to collect all data-files and libexec programs and whatnot of an executable and its transitive dependencies, and place them into a "bundle folder" and generate wrapper scripts which set the respective environment variables which would allow the executable to locate their auxilary data that would have lived in the Nix-style store. But it won't be a self-contained executable. But we should also take a step back and ensure this isn't an XY problem; is it just about resetting the Nix-style ~/.cabal/store from time to time, or is it like about generating binary distributions? For the former case the better approach is to implement store GC (see #3333), and for the binary distribution case I'm not sure you want to work from Nix-style store cached artifacts and instead build binaries appositely with the proper locations for data-files (living in the respective filesystem's conventional places, be it /opt/myapp/{lib,libexec,data,...} |
Although they proposed copying binaries I think @matil019 is quite clear about their concern (which is also my own): if I just don't want that point to get lost. I can certainly appreciate this is a tricky (and pre-existing) problem. |
Could we add a flag when v2-installing a binary to specify a data dir (or a prefix to datadirs) that's not in the store? And then have the same confirm/overwrite logic we have for executable copying? |
Nice to meet you!
I'd like to request a feature, which allows users to install executables with
cabal v2-install
as an actual copy of the executables instead of symlinks to them.The reason is that if symlinks are used, removing
~/.cabal/store
is no longer safe, in contrary to be described in the user guide:The text was updated successfully, but these errors were encountered: