Flake URL mutation on macOS

Hy guys, I’m trying my flake development environment for the first time on macOS
(Catalina, x86_64) and I’m experiencing a strange issue: I have a non flake input
which has an url like git+ssh://domain:7999/path_to_repo.git, activating the
devShell on macOS it tries to clone the git repo at
ssh://domain/port/path_to_repo.git … why this change from port to path fragment? Maybe I’m doing something in the wrong way?

I’m using nix version 2.4, nixpkgs is set to the “nixpkgs-21.11-darwin” channel
and git comes from It, not from XCode, whic isn’t installed

I’m compiling nixUnstable (2.5-pre2112…) and I’ll try with that

Nada, even with the latest Nix, the port of the URL gets translated into a path fragment, but on linux it works as expected…

To be clear, the input is defined as:

    myproject = {
      url = "git+ssh://git@foo.bar.com:7999/inter/myproject.git";
      flake = false;
    };

but then when I try to activate the devShell of that flake:

alberto@Albertos-MBP test % nix develop edev
fetching Git repository 'ssh://git@foo.bar.com/7999/inter/myproject.git'ssh: connect to host foo.bar.com port 22: Operation timed out
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
error: program 'git' failed with exit code 128
(use '--show-trace' to show detailed location information)

… and this happens with both the Xcode git or the nixpkgs one…

This appears to be a bug in Nix, in the code that attempts to detect URLs like git@github.com:NixOS/nix. I think the problem is the regex it uses to check for this is not anchored to the start. I will file a bug on this.

Thanks Lily, I haven’t yet look up for it in the code, but now I’ve switched the channel to nixos-unstable, upgraded all with nix-env -u and now repeating the command works, nix is now at version 2.5.1