Nix channel in private GitLab repo (query parameter in URL)

Can I use a URL with query parameters to get a channel with nix-channel?

I can add it using nix-channel --add 'https://gitlab.private.com/thegroup/theproject/-/archive/main/theproject-main.tar.gz?private_token=glpat-xxx' theproject, but when I run nix-channel --update I get

unpacking channels...
error: failed to open archive: Unrecognized archive format
error: builder for '/nix/store/3gl2bmzr40xizad1k2rg435hx4dhmrnn-theproject-2QsD2up13HjCkLpWpLLz.drv' failed with exit code 1
error: build of '/nix/store/3gl2bmzr40xizad1k2rg435hx4dhmrnn-theproject-2QsD2up13HjCkLpWpLLz.drv', '/nix/store/6amsimwrlfsrvawnanqm7mrp1x75c72i-nixpkgs.drv' failed
error: program '/nix/store/f837papmpi52ljfk7yzjjbqnn06x9bdp-nix-2.6.0/bin/nix-env' failed with exit code 100

I’m guessting it’s the query parameter that causes it, though I’m not certain.

Unfortunately it seems GitLab doesn’t support getting to a private repo using a URL format like https://<pwd>@gitlab.... , like GitHub does. So I’m at a loss here :disappointed:

1 Like

It should… Due to recent changes in our company infrastructure we currently use a on-premis GitLab over HTTPS, all repositories are private.

I can’t say if I could use them as a nix channel, but with git the just work as HTTPS URLs.

https://user:pass@gitlab.example.com

1 Like

Running into this issue made me finally take a look at home-manager. Using it I can reduce the number of channels considerably and using fetchGit to access GitLab is very easy.