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

Warn about the usage of filterSource with Nix store paths #5286

Merged
merged 1 commit into from
Oct 6, 2021

Conversation

ilkecan
Copy link
Member

@ilkecan ilkecan commented Sep 22, 2021

There is a lot of confusion caused by the behaviour of filterSource when used on a nix store path. I guess this is becoming more common with the increased usage of flakes, where the repository is moved to the store before the evaluation. This PR adds a warning that tries to explain why filterSource behaves unexpectedly and points the users to builtins.path instead.

Non exhaustive list of people's confusion:
https://discourse.nixos.org/t/flakes-and-filtersource/7787
https://discourse.nixos.org/t/builtins-filtersource-causes-rebuilds/12564
https://discourse.nixos.org/t/how-to-make-src-in-a-flake-nix-not-change-a-lot/15129

@ilkecan ilkecan marked this pull request as ready for review September 22, 2021 19:21
@edolstra edolstra added this to the nix-2.4 milestone Oct 6, 2021
Comment on lines 1924 to 1925
> `filterSource` should not be used to filter Nix output paths
> (directories whose parent is `/nix/store`). Since `filterSource`
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
> `filterSource` should not be used to filter Nix output paths
> (directories whose parent is `/nix/store`). Since `filterSource`
> `filterSource` should not be used to filter store paths. Since `filterSource`

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed it.

Warn about the usage of `filterSource` with Nix store paths
@ilkecan ilkecan force-pushed the add-a-warning-to-filterSource branch from fe89158 to a4a6ef4 Compare October 6, 2021 16:25
@edolstra edolstra merged commit 53e4794 into NixOS:master Oct 6, 2021
@ilkecan ilkecan deleted the add-a-warning-to-filterSource branch December 31, 2021 14:22
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.

2 participants