Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flake inputs: git submodules/recursive checkout #4357

Closed
SomeoneSerge opened this issue Dec 12, 2020 · 3 comments · Fixed by #4435
Closed

Flake inputs: git submodules/recursive checkout #4357

SomeoneSerge opened this issue Dec 12, 2020 · 3 comments · Fixed by #4435

Comments

@SomeoneSerge
Copy link

Is your feature request related to a problem? Please describe.

Can't just add git url to inputs to fetch sources with submodules.

Describe the solution you'd like

A recursive: bool field in flake inputs available when url refers to a git repo

Describe alternatives you've considered

Not using flake.lock or flake inputs, but instead using fetchFromGitHub

Additional context
Add any other context or screenshots about the feature request here.

knedlsepp added a commit to knedlsepp/nix that referenced this issue Jan 3, 2021
I want git submodules badly, so here is my equally bad try on adding
support for them.

TODO: This now unconditionally adds submodules for all flake inputs. Do
we want that?
This currently makes it equivalent to appending `?submodules=1` to the url.
I need to figure out how this can be done for `self`.

Fixes: NixOS#4357
knedlsepp added a commit to knedlsepp/nix that referenced this issue Jan 3, 2021
I want git submodules badly, so here is my equally bad attempt on adding
support for them in flakes.

TODO:
- This now unconditionally adds submodules for all flake inputs. Do we
  want that?
- This currently makes it equivalent to appending `?submodules=1` to the
  url. Do we want that?
- Figure out how this can be done for `self`.

Fixes: NixOS#4357
knedlsepp added a commit to knedlsepp/nix that referenced this issue Jan 3, 2021
I want git submodules badly, so here is my equally bad attempt on adding
support for them in flakes.

TODO:
- This now unconditionally adds submodules for all flake inputs. Do we
  want that?
- This currently makes it equivalent to appending `?submodules=1` to the
  url. Do we want that?
- Figure out how this can be done for `self`.
- Add a test for the behaviour

Fixes: NixOS#4357
knedlsepp added a commit to knedlsepp/nix that referenced this issue Jan 3, 2021
I want git submodules badly, so here is my equally bad attempt on adding
support for them in flakes.

TODO:
- This now unconditionally adds submodules for all flake inputs. Do we
  want that?
- This currently makes it equivalent to appending `?submodules=1` to the
  url. Do we want that?
- Figure out how this can be done for `self`.
- Add a test for the behaviour

Fixes: NixOS#4357
@ruler501
Copy link

ruler501 commented Jan 7, 2021

It would also be good if it copied over submodules when building devShell for a local flake. A project I'm working on needs to reference files in a git submodule to make its devShell, but the flake for it doesn't work currently since nix develop does not see files in submodules.

@ruler501
Copy link

ruler501 commented Jan 7, 2021

It took me a while to parse through how nix develop fetches the files. I would propose to change src/nix/command.hh:138 like this

-    std::string _installable{"."};
+    std::string _installable{".?submodules=1"};

That would allow you to not have it be unconditional for all locally referenced repos.
It would also be good if we could add it to the github scheme, but looking at the code that seems very non-trivial and people can always fall back to the git reference instead.

@con-f-use
Copy link

con-f-use commented Oct 26, 2022

By the way, to add insult to injury, nix doesn't even tell that it's because you're using something from a submodule. It just says something like:

error: getting status of '/nix/store/qjj8lgnp70m9842n2qr4bljb3hrd04dh-source/mysubmodule': No such file or directory

For context, that is if "mysubmodule" is a submodule of my current flake project managed in git and I'm using a file from that project somewhere. A file that physically exists on the drive, because the project repository was checked out recursively.
That error message could be much better and suggest a resolution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants