Nixpkgs: fetchFromGitLab does not know how to unpack source

Created on 2 Aug 2019  路  9Comments  路  Source: NixOS/nixpkgs

Describe the bug

fetchFromGitLab {
  domain = "salsa.debian.org";
  owner = "games-team";
  repo = "xteddy";
  rev = "debian/${version}";
  sha256 = "0rm7w78d6qajq4fvi4agyqm0c70f3c1i0cy2jdb6kqql2k8w78qy";
}

fails with do not know how to unpack source archive /build/2.2-5.
Manually unpacking with tar works just fine.

Any suggestions on how to fix this?

Metadata
Please run nix run nixpkgs.nix-info -c nix-info -m and paste the result.

  • system: "x86_64-linux"
  • host os: Linux 5.2.4, NixOS, 19.09pre186857.239fffc90d7 (Loris)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.2.2
  • channels(root): "nixos-19.09pre186857.239fffc90d7"
  • channels(pantarhei): ""
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos
bug stale

All 9 comments

i notice that sometimes the unpack fails if more than one output is produced. You may need to override the unpack phase.

unpackPhase = ''
  tar xf $src
'';

That doesn't seem to fix this case. If I understand the code for fetchFromGitLab and fetchzip correctly, these bypass the unpack phase.

interesting, I haven't used fetchFromGitLab yet, sorry :(

This is an issue with the archiving api of GitLab. See: https://github.com/NixOS/nixpkgs/issues/48215 https://gitlab.com/gitlab-org/gitlab-ce/issues/38537. As a workaround can you try the following?

--- /tmp/orig.nix   2019-08-02 15:02:03.000000000 -0500
+++ /tmp/new.nix    2019-08-02 15:02:44.000000000 -0500
@@ -2,6 +2,6 @@
   domain = "salsa.debian.org";
   owner = "games-team";
   repo = "xteddy";
-  rev = "debian/${version}";
+  rev = "debian%2F${version}"; # %2F = urlquote("/")
   sha256 = "0rm7w78d6qajq4fvi4agyqm0c70f3c1i0cy2jdb6kqql2k8w78qy";
 }

@marsam I can confirm that this would fix the issue (i've had it before).
Eventually it would be nice if fetchFromGitLab could url encode rev.

That did indeed work. Is it a good idea to use this workaround in a package? If url quoting gets implemented one day, that piece might get double quoted (I could go with fetchgit instead).

It should check if it's already url encoded. Should be fine to do this.

Ok, thanks :-)
I will keep this open just in case someone hits this..

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.
Was this page helpful?
0 / 5 - 0 ratings

Related issues

sid-kap picture sid-kap  路  3Comments

chris-martin picture chris-martin  路  3Comments

rzetterberg picture rzetterberg  路  3Comments

ob7 picture ob7  路  3Comments

yawnt picture yawnt  路  3Comments