Skip to content

unable to fetch flake submodule (unexpected authority) using SSH transport #14852

@tones111

Description

@tones111

Describe the bug

I'm trying to add a submodule to my NixOS flake repository to segregate secrects, but attempting to nix flake update or nixos-rebuild build results in an unexpected error:

$ sudo nixos-rebuild build
building the system configuration...
warning: could not read HEAD ref from repo at '/home/paul/src/nix-config', using 'master'
error:
       … while fetching the input 'git+file:///home/paul/src/nix-config?rev=de26939a1ff68c8e38542163e0c9d17555e17f4f&submodules=1'

       error: file:// URL 'file://moserv.lan.home.arpa:/storage/src/nix-secrets.git' has unexpected authority 'moserv.lan.home.arpa'

Steps To Reproduce

  1. Add a submodule to your flake repository: git submodule init && git submodule add some_server:/path/to/repo.git secrets
  2. Update flake.nix to declare submodule use: inputs.self.submodules = true;
  3. Attempt to build sudo nixos-rebuild build
  4. Observe "has unexpected authority error"

Expected behavior

flake builds successfully

Metadata

$ nix-env --version
nix-env (Nix) 2.31.2+1

Additional context

The error is similar to #7545 #14244, but I think this is likely a different edge case.

The error didn't occur immediately. It was only once the changes to my NixOS configuration started stabilizing that the failure started happening every time. Also, it appears to work better when the username is specified in the submodule url (user@host:/path/to/reo.git), however, that prevents other users from being able to work on the repository.

Checklist


Add 👍 to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions