Nix: flake input url doesn't support branches with slashes

Created on 24 Sep 2020  路  4Comments  路  Source: NixOS/nix

Describe the bug

It seems that branches with slashes in them (e.g. feat/flake) aren't supported in input urls.
Neither of these work:
"github:Myhlamaeus/pre-commit-hooks.nix/feat/flake"
"github:Myhlamaeus/pre-commit-hooks.nix?ref=feat/flake"

Steps To Reproduce

Reference a git branch with a / in a flake.nix, for example:

inputs.pre-commit-hooks.url = "github:Myhlamaeus/pre-commit-hooks.nix/feat/flake";

Expected behavior
Flake should be downloaded.

nix-env --version output
nix-env (Nix) 3.0pre20200829_f156513

bug

Most helpful comment

I don't think the first one should be supported since it's pretty ambiguous.

It's better in this case to use the attrset notation:

inputs.pre-commit-hooks = {
  type = "github";
  owner = "Myhlamaeus";
  repo = "pre-commit-hooks.nix";
  ref = "feat/flake";
};

All 4 comments

@felschr would you mind testing #4115 :)

I don't think the first one should be supported since it's pretty ambiguous.

It's better in this case to use the attrset notation:

inputs.pre-commit-hooks = {
  type = "github";
  owner = "Myhlamaeus";
  repo = "pre-commit-hooks.nix";
  ref = "feat/flake";
};

It could be supported for the ?ref= case though, no?

Was this page helpful?
0 / 5 - 0 ratings