You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don’t know if this is solvable, but perhaps there are some mitigations.
If you have Project Manager configured to allow non-Nix-using contributors, then this isn’t an issue, as all generated files will have “repository” persistence.
However, if you intend contributors to use Nix, but someone isn’t (perhaps a direnv failure or forgot to run nix develop), then binaries on their system PATH may lead to confusing or inconsistent behavior.
E.g., clang-format can run without a .clang-format file. If the .clang-format file in your repo has “store” persistence, but the user runs clang-format outside of a Project Manager environment, it’ll format using the default style.
One way to prevent this would be to add a .clang-format file to the worktree containing something like
# IMPORTANT: `clang-format` must be run from a Project Manager environment.
# Run `direnv reload` or `nix develop .#project-manager` and then run `clang-format` there.
broken config = cause clang-format to error
which would result in clang-format erroring instead of formatting the files.
Of course, this still requires the user to have run project-manager switch to generate this erroneous file in the first place. Giving it “repository” persistence would avoid that.
However, once you’re generating these files, why not just give the correct file the higher persistence in the first place? One reason might be that clang-format v15 and clang-format v16 cause different formatting even with identical files.
Regardless, this approach seems far from ideal. I wouldn’t use it personally.
Another option might be to have direnv produce an empty environment rather than failing, so that you can’t overlook the failure and accidentally run programs from outside the environment. But this is also not something I would do personally.
The text was updated successfully, but these errors were encountered:
I don’t know if this is solvable, but perhaps there are some mitigations.
If you have Project Manager configured to allow non-Nix-using contributors, then this isn’t an issue, as all generated files will have “repository” persistence.
However, if you intend contributors to use Nix, but someone isn’t (perhaps a direnv failure or forgot to run
nix develop
), then binaries on their system PATH may lead to confusing or inconsistent behavior.E.g.,
clang-format
can run without a .clang-format file. If the .clang-format file in your repo has “store” persistence, but the user runsclang-format
outside of a Project Manager environment, it’ll format using the default style.One way to prevent this would be to add a .clang-format file to the worktree containing something like
which would result in
clang-format
erroring instead of formatting the files.Of course, this still requires the user to have run
project-manager switch
to generate this erroneous file in the first place. Giving it “repository” persistence would avoid that.However, once you’re generating these files, why not just give the correct file the higher persistence in the first place? One reason might be that clang-format v15 and clang-format v16 cause different formatting even with identical files.
Regardless, this approach seems far from ideal. I wouldn’t use it personally.
Another option might be to have
direnv
produce an empty environment rather than failing, so that you can’t overlook the failure and accidentally run programs from outside the environment. But this is also not something I would do personally.The text was updated successfully, but these errors were encountered: