-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Flake: cannot extract input tarball / zip that has more than 1 top-level directory #7083
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
Comments
Indeed.
The reason for that is that it's apparently a very common thing to have all your archive contents under one top-level directory (in particular that's what I think that behavior is the right one (it's what people will spontaneously expect), but that shouldn't prevent us from supporting archives with multiple top-level directories. I think we can either:
I personally have a slight preference for the first option because it is "nicer" in that most things work out-of-the box with it. But it might also be a bit confusing because an archive containing only |
Ahh, that indeed makes sense. I do personally prefer the first option as well for the same reason, but I think the second would be preferable as a solution. Confusing behaviour isn't ideal. Besides, after a bit of digging, I see that there is already a |
This just bit me when trying to package https://github.com/vector-im/hydrogen-web/releases/download/v0.3.8/hydrogen-web-0.3.8.tar.gz which funnily enough appears in Oh well. |
Issue NixOS#7083 suggests two solutions to this problem: 1. If there are multiple top-level files, use the archive root 2. A stripRoot attribute, like in nixpkgs' fetchzip This patch implements (1). It is forward-compatible with (2) if a missing stripRoot is interpreted as "automatic". Fixes NixOS#7083
I implemented (1) in #9053 |
Issue NixOS#7083 suggests two solutions to this problem: 1. If there are multiple top-level files, use the archive root 2. A stripRoot attribute, like in nixpkgs' fetchzip This patch implements (1). It is forward-compatible with (2) if a missing stripRoot is interpreted as "automatic". Fixes NixOS#7083
Issue NixOS#7083 suggests two solutions to this problem: 1. If there are multiple top-level files, use the archive root 2. A stripRoot attribute, like in nixpkgs' fetchzip This patch implements (1). It is forward-compatible with (2) if a missing stripRoot is interpreted as "automatic". Fixes NixOS#7083
I think this was fixed in #11195 |
Describe the bug
When specifying a flake input that's a tarball or zip, Nix complains that the archive
contains an unexpected number of top-level files
if the archive contains more than 1 top-level directory.This seems to have been brought up before in this discourse thread back in February. The root cause is from the
fetchTarball
fetcher; in particular this section. I'm not sure what the rationale is for expecting only 1 top-level directory, but in the context of flake inputs, it can be quite a blocker when fetching archives from other parties as we cannot control how they're structured.Steps To Reproduce
Example flake input:
When attempting to build, the following error is shown:
error: tarball 'https://github.com/catppuccin/gtk/raw/fc336313a84e0d7ec1a3499047fb1e73eef8a005/Releases/Catppuccin-Macchiato.zip' contains an unexpected number of top-level files
Expected behavior
The tarball / zip should be extracted without any errors.
nix-env --version
outputnix-env (Nix) 2.11.0
The text was updated successfully, but these errors were encountered: