ctem
February 4, 2021, 6:56pm
1
Hi all,
The wiki page offers the following syntax:
inputs.bar.url = "github:foo/bar/branch";
.
Say I have a branch called “feature/something” in a GitLab repo. These throw the BadURL
error:
inputs.bar.url = "gitlab:foo/bar/feature/something";
inputs.bar.url = "gitlab:foo/bar/-/tree/feature/something";
I also tried replacing the /
in the branch name with %2F
as a long shot, but alas…
Any thoughts before I go digging through the schema to determine whether this is currently possible?
Thanks!
hmenke
February 4, 2021, 7:32pm
2
This could maybe suffice as a workaround (untested)
inputs.bar.url = "git+https://gitlab.com/foo/bar.git?ref=feature/something";
1 Like
NobbZ
February 4, 2021, 8:57pm
3
gitlab:owner/repo?ref=feature/simething
should do as well and should also work with github
and git
URLs
ctem
February 6, 2021, 8:11am
4
Thank you for your helpful replies!
@hmenke This works. It should be noted, however, that the difference in URL syntax causes the whole repo to be refetched. For example, for a repo with feature/something
as the default branch:
Specify it as a flake input with the implicit gitlab:owner/repo
syntax and build.
Update the URL to specify the branch explicitly using the syntax you provided and rebuild.
The repo is fetched from the “new” URL, and the lock file is updated:
* Updated 'my-input': 'gitlab:owner/repo/6a47e8...' -> 'git+https://gitlab.com/owner/repo?ref=feature%2fsomething&rev=6a47e8...'
Talk about hermetic !
@NobbZ The abbreviated syntax you suggested would be nice but throws BadURL
for me, complaining that the URL contains an invalid branch/tag name
.
Ma27
February 6, 2021, 8:17am
5
Slashes in a branch name should be supported since https://github.com/NixOS/nix/pull/4115 .
1 Like
ctem
February 6, 2021, 8:21am
6
Excellent! Thank you for your work on this.