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
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?
This could maybe suffice as a workaround (untested)
inputs.bar.url = "git+https://gitlab.com/foo/bar.git?ref=feature/something";
gitlab:owner/repo?ref=feature/simething should do as well and should also work with
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.
Slashes in a branch name should be supported since https://github.com/NixOS/nix/pull/4115.
Excellent! Thank you for your work on this.