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

Fetch submodules if supported, and warn if submodules are used but not supported #352

Merged
merged 1 commit into from
Apr 27, 2022

Conversation

tfc
Copy link
Contributor

@tfc tfc commented Apr 21, 2022

Referencing @awidegreen's PR #351, this one here does the same but also adds a warning if submodules are used but not supported by the user's nix version.

In that corner case, the user get's at least a warning trace on their shell that explains what's wrong here. Builds can still fail, but not silently without some hint on the reason.

Copy link
Owner

@nmattia nmattia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! One comment

nix/sources.nix Outdated Show resolved Hide resolved
Copy link
Owner

@nmattia nmattia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@tfc
Copy link
Contributor Author

tfc commented Apr 21, 2022

@nmattia i am not sure where the error in the CI comes from. Looking at the source code we have a $(embedFile "nix/sources.nix") which should automatically be the right thing, right?

I currently don't see how i would fix that, can you give me a pointer?

@nmattia
Copy link
Owner

nmattia commented Apr 21, 2022

Ah yes! Each version of sources.nix is versioned here. If you allow me, I'll make the necessary changes and push to your branch; if on the other hand you feel like doing it yourself, it should be as simple as:

@tfc
Copy link
Contributor Author

tfc commented Apr 21, 2022

Interesting, thank you. I added it all. Let's see what the pipeline says.

@nmattia
Copy link
Owner

nmattia commented Apr 21, 2022

Looking at the changes, it seems that you may be using a different version of nixpkgs-fmt than the CI. Did you run ./scripts/fmt or did you use a version of nixpkgs-fmt installed on your system?

@SuperSandro2000
Copy link

if submodules are used but not supported by the user's nix version.

I don't think it should warn there. Often submodules are vendored projects which can be replaced by system libraries.

@tfc
Copy link
Contributor Author

tfc commented Apr 21, 2022

I don't think it should warn there. Often submodules are vendored projects which can be replaced by system libraries.

I am sure such repos exist. In such cases you are still free to set submodules = false and use it as you describe.

If repos cannot live without their submodules, then we get silent failures here, which is very bad.

@tfc
Copy link
Contributor Author

tfc commented Apr 21, 2022

@nmattia it seems this time everything looks green! Thank you for your help.

@tfc
Copy link
Contributor Author

tfc commented Apr 23, 2022

Is anything left to do before this can be merged?

Copy link
Owner

@nmattia nmattia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The weird formatting thing aside, LGTM!

nix/sources.nix Outdated
Comment on lines 170 to 180
mapAttrs
(
name: spec:
if builtins.hasAttr "outPath" spec
then
abort
"The values in sources.json should not have an 'outPath' attribute"
else
spec // { outPath = replace name (fetch config.pkgs name spec); }
)
config.sources;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any idea why this got (re-)formatted?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have absolutely no clue. It seems like the nixpkgs-fmt version used in this project is relatively old

@tfc
Copy link
Contributor Author

tfc commented Apr 26, 2022

@nmattia ok, does the weird formatting block the pull request now, so do i need to analyze why the tool decided to format this unrelated block of code, or is it ok?

@tfc
Copy link
Contributor Author

tfc commented Apr 27, 2022

@nmattia i am happy to do anything that's necessary to make this mergeable. Right now i don't know what's missing and i also don't know if there is anything else that you need (time to review because you are busy right now (in that case shall we add any other reviewers? do we need more testing? or anything else having to be merged before this or something?), so please let me know.

@nmattia
Copy link
Owner

nmattia commented Apr 27, 2022

@tfc my bad, I was out for a few days! Should have been clearer: I'm confused as to why the formatting was changed around line 170, but it looks good to me nonetheless! For me you can merge at will :) You could revert the formatting on line 170 (maybe it was done by your editor? either way nixpkgs-fmt doesn't seem to mind, but probably cleaner to remove it so that future git blamers don't get confused) but you could also just merge as is. Your call, and thanks a lot for the contribution!

@tfc
Copy link
Contributor Author

tfc commented Apr 27, 2022

Ok. So the additional format change was my mistake, sorry for the resulting noise. I removed it.

Btw. once the tests are confirmed green: i have no merge rights so i can't follow the "you could also just merge"

@nmattia nmattia merged commit 945aa20 into nmattia:master Apr 27, 2022
@nmattia
Copy link
Owner

nmattia commented Apr 27, 2022

There you go, thanks a lot!

@tfc tfc mentioned this pull request Apr 28, 2022
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 this pull request may close these issues.

3 participants