-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
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
Remove .envrc #325793
Remove .envrc #325793
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as NixOS/nixfmt#178.
Yes. Even less in favor of it here as the scope of use cases is much broader.
|
Shouldn't the |
In a previous discussion I gave a bunch of workarounds: #322650 (comment). Do those not work for you? I'd appreciate more info on your use case. And if they really don't work, I'd prefer a solution of sourcing a different additional file like |
FWIW, Lix has implemented a similar workaround: https://git.lix.systems/lix-project/lix/src/branch/main/.envrc However, I'd argue that this should primarily be fixed upstream, i.e. in direnv itself. |
When I am packaging up & testing the execution of derivation, I have used environment variables for the executable’s settings, to turn on & make sure certain debugging flags still work, for setting different prelude/stdlib/other lib locations, etc. since you need to test that execution still works. Until I have packaged it correctly, having a persistent state for these variables is useful as it might take a few days hacking on a toolchain I am unfamiliar with. Doing all testing inside the sandbox is often slow, & it is still worth testing the binary works outside the sandbox too. In other places, I have used RE: lix’s
When you see projects in say the PHP space using Dotenv + This is not also not addressing the scary, big, red, we-will-execute-code-on-your-machine banner you get when cloning the repository for the first time for those with Direnv installed (which I appreciate they ask for consent, +1). Especially if just wanting to read the code or make a documentation fix which does not require the Nix shell, this is a bit of a shock & a distraction. The current behavior might be the experience you would want at some Big.Corp where everyone will be required to consent to the environment, & everyone with repo access will be expected to be developing on the code, but nixpkgs, while big, isn’t Big.Corp where users of many backgrounds/experiences/use cases are paying a visit & I would argue Nixpkgs doesn’t need to suggest or endorse extra tooling unless required (even if it tooling I like & use daily). |
Thanks for the explanation of your use case, indeed I don't think any workaround is fit for this, so again I suggest you add support for a
The value comes from users automatically being informed about the shell existing. Without that, most users wouldn't even be aware of it. It also comes with editor integration for a very smooth auto-formatting experience. And note that even just in public GitHub repos, over 14k of them commit their |
Not uncommon is not the same as not what the developer intended, as quoted. Folks do stuff wrong all the time (it’s been a decade where I am still trying to get folks to stop using icon fonts, & look at any project with config not following XDG, |
For what it’s worth, I think a fairly serious concern that isn’t related to any of these more subjective issues of preference is that if you run That’s an issue with direnv in general – and I do still use and like it – but Nixpkgs is an especially central target given that it is so popular and that maintainers are constantly dealing with a large number of essentially untrusted pull requests. (You could fairly argue that anyone reviewing Nixpkgs PRs should take greater precautions in general as a result of this, but in practice I suspect almost none do.) |
One potential solution would be to provide the relevant shell environment as an export from Nixpkgs and ensure that the |
I use worktrees a lot to work on several things at once, review PRs and such. Often these worktrees are short-lived. Since direnv records consent per path this basically means I get pestered with the warning no matter how many times I (dis)allow. I really hope an alternative way of informing people how to enable useful tool integrations is found. Preferably one that doesn't force one particular solution among many alternatives, instructions that achieve equivalent behavior using Lorri for example. |
I'd argue that this is only an issue with direnv-nix, because direnv generally checks the file for modifications and asks you for re-approval. Only when sourcing stuff from elsewhere (as is done in direnv-nix by default) causes the attack vector you describe. Since I already advocated for upstream fixes to problems earlier, the mitigation would be to allow to track external files as part of the direnv source for modifications. As prior art, we already have the |
I just noticed somebody accidentally pushing their |
This reverts commit f0160ba. This is an anti-feature for this project.
Yes. However I don’t think it would be feasible to prompt people for reapproval every time any file involved in the building of a Haskell project like I lean more and more towards going with this PR and only shipping an
|
I see. To prevent that, we'd have to not only pin the package but the entire Nixpkgs instead, so that only pin bumps re-prompt. Not sure if that's the current plan though |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright let's just go ahead with this PR for now. There's some good arguments for this, arguments which only make sense at the scale of Nixpkgs, and it's not hard to just do echo 'use nix' > .envrc
for those that want it, even though it would be nice not needing to do that.
Description of changes
f0160ba#commitcomment-143982098
I use this file to work with different environment variables while working with derivations. With this file being tracked, now I am more prone to accidentally commit as well as needing to stash my changes just to get the latest code from
git pull --rebase upstream master
. I strongly feel this file is for personal use & just like you shouldn’t commit your personal editor’s config to the repository, leave this file alone so users can customize it--the ones that want to use direnv canecho 'use nix' >> .envrc && direnv allow
which does not get in anyone’s way. With the red consent banner pop-up & forced default settings, tracking this file provides a degraded user experience for this project, not an improved one.#322512
#322650
This threads are full of objections & similar use cases along with hacky solutions about
.env.*
ignored files. Just because one user says they are fine losing their workflow, does not assume everyone else is. I don’t follow all Nixpkgs threads to join the original discussion since there are thousands, so I don’t notice til things are merged & discussion is over.Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.