Create lint for absolute path literals#15345
Conversation
f12f78f to
60b8a33
Compare
60b8a33 to
7c426a7
Compare
|
|
||
| Absolute path literals can make Nix expressions less portable and reproducible, as they depend on the filesystem layout of the machine evaluating the expression. | ||
|
|
||
| Also note that with [pure evaluation mode](@docroot@/command-ref/conf-file.md#conf-pure-eval), accessing files not so easily accessed via relative paths is often prohibited anyways. |
There was a problem hiding this comment.
| Also note that with [pure evaluation mode](@docroot@/command-ref/conf-file.md#conf-pure-eval), accessing files not so easily accessed via relative paths is often prohibited anyways. | |
| Also note that with [pure evaluation mode](@docroot@/command-ref/conf-file.md#conf-pure-eval), accessing files not so easily accessed via relative paths is often prohibited anyway. |
Too germanic and too long. Idk, not a linguist.
There was a problem hiding this comment.
Reworded, and move from release notes to the settings description, where it will be read more on an ongoing basis.
7c426a7 to
ed494f0
Compare
|
Does this interact in any way with builtins.storePath. Are there any legitimate use cases for absolute path value usages? |
|
It does not interact with |
| NIX_CONFIG='lint-absolute-path-literals = warn' nix eval --lint-absolute-path-literals ignore --expr '/tmp/bar' 2>"$TEST_ROOT"/stderr | ||
| grepQuietInverse "absolute path literal" "$TEST_ROOT/stderr" | ||
|
|
||
| echo "absolute-path-literals test passed!" |
…val-2 Create lint for absolute path literals
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/remove-all-absolute-path-literals-from-nixpkgs/77245/5 |
|
Motivation
Fixes #8738
Context
Besides the direct user benefit of having this lint, this reduces the evaluator's usage of
rootFS, which also gets us closer to #9549.Review with whitespace disabled.
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.