Skip to content

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

@garbas

Description

@garbas

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    UXThe way in which users interact with Nix. Higher level than UI.new-cliRelating to the "nix" command

    Projects

    Status

    In Progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions