NixOS / nix

Nix, the purely functional package manager
https://nixos.org/
GNU Lesser General Public License v2.1
12.79k stars 1.52k forks source link

`nix flake update '.?submodules=1'` stopped working inside git-submodule after nix 2.14 #9695

Open afreakk opened 10 months ago

afreakk commented 10 months ago

Describe the bug

After version 2.14 of nix, nix flake update ".?submodules=1" expects ./.git to be a directory, not a file. (Only when using ?submodules=1 in my experience) If its a file, like it is in a submodule. it will error and not finish.

Steps To Reproduce

  1. Have nix version 2.14 or higher (havent tested beyond 2.18.1)
  2. Have flake.nix inside a git-submodule (which then will have a .git file not a directory)
  3. Run nix flake update ".?submodules=1"
  4. See error:
    making temporary clone of '/a/b/nixos-config' 
    … while fetching the input 'git+file:///a/b/nixos-config' error: 
    opening file '/a/b/nixos-config/.git/config': Not a directory.
    • fun fact: using nix flake update works, so this is only an issue when using nix flake update inside a git submodule that has git submodules.
    • Downgrading to 2.13 also works

Expected behavior

It should be able to handle .git being a file, like it is in git submodules.

Priorities

Add :+1: to issues you find important.

bburdette commented 7 months ago

I've been doing nix build "git+file://$(pwd)?submodules=1" in my project, and that quit working. Twist in my case is there's a submodule within a submodule; I only get the error for the sub-submodule.