Skip to content

The git:// flake-URL type doesn't work #9612

@iFreilicht

Description

@iFreilicht

Describe the bug

The docs on flake references give a few examples for how the git:// URL type can be used. Two of them don't work:

  • git:/home/user/sub/dir
  • git://github.com/edolstra/dwarffs?ref=unstable&rev=e486d8d40e626a20e06d792db8cc5ac5aba9a5b4

Steps To Reproduce

Local git repo:

$ file /Users/feuh/repos/nixpkgs
/Users/feuh/repos/nixpkgs: directory
$ nix shell git:/Users/feuh/repos/nixpkgs#python3
ssh: Could not resolve hostname git: nodename nor servname provided, or not known
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
warning: could not read HEAD ref from repo at 'git:/Users/feuh/repos/nixpkgs', using 'master'
ssh: Could not resolve hostname git: nodename nor servname provided, or not known
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
error:
       … while fetching the input 'git:/Users/feuh/repos/nixpkgs'

       error: program 'git' failed with exit code 128

Remote git repo:

$ nix shell git://github.com/edolstra/dwarffs
fatal: unable to connect to github.com:
github.com[0: 140.82.121.3]: errno=Operation timed out

warning: could not read HEAD ref from repo at 'git://github.com/edolstra/dwarffs', using 'master'
fatal: unable to connect to github.com:
github.com[0: 140.82.121.3]: errno=Operation timed out

error:
       … while fetching the input 'git://github.com/edolstra/dwarffs'

       error: program 'git' failed with exit code 128

Manually specifying (or omitting) the file, ssh or https prefixes works:

$ nix shell git+file:/Users/feuh/repos/nixpkgs#python3
$ nix shell /Users/feuh/repos/nixpkgs#python3
$ nix shell git+ssh://github.com/edolstra/dwarffs
$ nix shell git+https://github.com/edolstra/dwarffs

Expected behavior

I would expect all of these to work.

nix-env --version output

nix-env (Nix) 2.18.1

Additional context

While testing this, I also found that nix shell git+https://github.com/NixOS/nixpkgs has zero output for a long time while it's downloading. That would be a separate issue, though.

Priorities

Add 👍 to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugfetchingNetworking with the outside (non-Nix) world, input locking

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions