Skip to content

Flake: cannot extract input tarball / zip that has more than 1 top-level directory #7083

Description

@dixslyf

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:

catppuccin-gtk-macchiato = {
  url = "https://github.com/catppuccin/gtk/raw/fc336313a84e0d7ec1a3499047fb1e73eef8a005/Releases/Catppuccin-Macchiato.zip";
  flake = false;
};

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 output
nix-env (Nix) 2.11.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions