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

Be smart and helpful when some files are missing during the evaluation #4507

Open
garbas opened this issue Feb 1, 2021 · 5 comments
Open
Labels
new-cli Relating to the "nix" command UX The way in which users interact with Nix. Higher level than UI.

Comments

@garbas
Copy link
Member

garbas commented Feb 1, 2021

A change that is (already) confusing some Nix developers (including me) is that in the case of project repository being tracked under git only files tracked by git are visible by nix build. It happens that a user will forget to add a file to git and nix build will complain that it can not find a file during nix build.

In contrast "old" nix-build will usually copy everything under the project folder (well depends what your src = ... looks like).

Now there is a good reason that this behavior changed. With this a user will catch a problem earlier locally instead of pushing to upstream and only then realizing that CI failed due to a missing file.

But we need to help the user understand what is happening and that this is a feature that is saving him time and not just

I propose to do the following:

  • In case of missing nix files we can already suggest what the problem can be. This error happens during the evaluation. The edge case we must make sure it works is a missing flake.nix (this is possible if you first create a nix project and only then git repository). With this error we can point directly to which file is missing

  • In case of non-nix missing files we can not directly point which file(s) is missing and causing nix build to fail. What we can show is that there is a number of untracked files in Git and that Nix when used with git will only see files tracked by git. Please run git status and add missing files.

/cc @edolstra

@garbas garbas added UX The way in which users interact with Nix. Higher level than UI. new-cli Relating to the "nix" command labels Feb 1, 2021
@garbas garbas added this to the nix-2.4 milestone Feb 1, 2021
@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/flakes-cognitive-overload-gateway-drugs-self-contained-simple-recipes/11614/10

@thufschmitt thufschmitt self-assigned this Jul 7, 2021
thufschmitt added a commit that referenced this issue Jul 7, 2021
When evaluating a local git flake, if a file a missing at eval-time but
present in the source directory, tell the user that he probably forgot
to check it out

Fix #4507
thufschmitt added a commit that referenced this issue Jul 7, 2021
When evaluating a local git flake, if a file a missing at eval-time but
present in the source directory, tell the user that he probably forgot
to check it out

Fix #4507
@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/tweag-nix-dev-update-15/13975/1

@edolstra edolstra modified the milestones: nix-2.4, nix-3.0 Sep 14, 2021
thufschmitt added a commit that referenced this issue Nov 16, 2021
When evaluating a local git flake, if a file a missing at eval-time but
present in the source directory, tell the user that he probably forgot
to check it out

Fix #4507
@edolstra edolstra modified the milestones: nix-2.5, nix-2.6 Dec 10, 2021
@garbas garbas moved this to In Progress in Nix UX Dec 16, 2021
@garbas garbas added this to Nix UX Dec 16, 2021
@edolstra
Copy link
Member

edolstra commented Jan 6, 2022

This will be fixed as part of #3121.

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/tweag-nix-dev-update-24/17230/1

@edolstra edolstra modified the milestones: nix-2.6, nix-2.7 Jan 21, 2022
@edolstra edolstra modified the milestones: nix-2.7, nix-2.8 Mar 3, 2022
@thufschmitt thufschmitt removed their assignment Mar 12, 2022
@edolstra edolstra modified the milestones: nix-2.8, nix-2.9 Apr 14, 2022
@edolstra edolstra modified the milestones: nix-2.10, nix-2.11 Jul 11, 2022
@edolstra edolstra modified the milestones: nix-2.11, nix-2.12 Aug 25, 2022
@edolstra edolstra modified the milestones: nix-2.12, nix-2.13 Dec 6, 2022
@edolstra edolstra modified the milestones: nix-2.13, nix-2.14 Jan 17, 2023
@edolstra edolstra modified the milestones: nix-2.14, nix-2.15 Feb 28, 2023
@edolstra edolstra modified the milestones: nix-2.15, nix-2.16, nix-2.17 May 26, 2023
@edolstra edolstra modified the milestones: nix-2.17, nix-2.18 Jul 24, 2023
@edolstra edolstra modified the milestones: nix-2.18, nix-2.19 Sep 20, 2023
@edolstra edolstra modified the milestones: nix-2.19, nix-2.20 Nov 20, 2023
@edolstra edolstra modified the milestones: nix-2.20, nix-2.21 Mar 4, 2024
@edolstra edolstra modified the milestones: nix-2.21, nix-2.22 Mar 11, 2024
@edolstra edolstra modified the milestones: nix-2.22, nix-2.23 Apr 23, 2024
@edolstra edolstra removed this from the nix-2.23 milestone Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-cli Relating to the "nix" command UX The way in which users interact with Nix. Higher level than UI.
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

5 participants