-
-
Notifications
You must be signed in to change notification settings - Fork 986
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
Set IN_NIX_SHELL=1 for tests #7800
Conversation
This helps isolating system-wide zsh instance running in tests from the broader system shell initialization for limited nix environments. This fixes failures as reported here: NixOS/nixpkgs#312692 Signed-off-by: Ihar Hrachyshka <[email protected]>
What exactly does IN_NIX_SHELL do and can you please add a comment explaining what it does in basic_shell_env() |
As far as I can tell from a quick google valid values for it are pure/impure and its effects are undefined, depending on individual pkgs. https://nix.dev/manual/nix/2.18/command-ref/nix-shell#env-IN_NIX_SHELL |
It very well may be that this is not a correct fix. Let me describe what I'm trying to achieve and why this helps. The reason why test suite fails is that while
So tests adding And here is what is in
If the variable is not set, my full zsh environment is initialized, which triggers the following command (comes from
...which produces some errors on the screen and make the tests fail. Setting |
I'm looking at this a bit closer, and I wonder if perhaps the root of the issue is not in the test suite, or not even in zsh, but in the fact that Here is where the command is injected into the env: https://github.com/LnL7/nix-darwin/blob/ac5694a0b855a981e81b4d9f14052e3ff46ca39e/modules/programs/gnupg.nix#L46 I wonder if it should be Do you think I should do this instead? |
Yes, generally speaking, having things that potentially spew errors in Closing as IMO this should be fixed in nix. |
In some scenarios, the command may fail, e.g. when the shell is executed with a different $HOME from where gpg agent is configured to run from. (E.g. this happens in kitty terminal test suite.) This patch will suppress stderr errors on tty in this situation. Note that zsh does not allow to suppress execution of /etc/zshenv on startup, so it's impossible to skip it in the test suite environment. An alternative would be to set IN_NIX_SHELL in the test suite, but this was rejected in upstream: kovidgoyal/kitty#7800 Signed-off-by: Ihar Hrachyshka <[email protected]>
In some scenarios, the command may fail, e.g. when the shell is executed with a different $HOME from where gpg agent is configured to run from. (E.g. this happens in kitty terminal test suite.) This patch will suppress stderr errors on tty in this situation. Note that zsh does not allow to suppress execution of /etc/zshenv on startup, so it's impossible to skip it in the test suite environment. An alternative would be to set IN_NIX_SHELL in the test suite, but this was rejected in upstream: kovidgoyal/kitty#7800 There's also a kitty package specific fix posted here but this may be unnecessary once nix-darwin is patched here: NixOS/nixpkgs#338070 Signed-off-by: Ihar Hrachyshka <[email protected]>
In some scenarios, the command may fail, e.g. when the shell is executed with a different $HOME from where gpg agent is configured to run from. (E.g. this happens in kitty terminal test suite.) This patch will suppress stderr errors on tty in this situation. Note that zsh does not allow to suppress execution of /etc/zshenv on startup, so it's impossible to skip it in the test suite environment. An alternative would be to set IN_NIX_SHELL in the test suite, but this was rejected in upstream: kovidgoyal/kitty#7800 There's also a kitty package specific fix posted here but this may be unnecessary once nix-darwin is patched here: NixOS/nixpkgs#338070 Signed-off-by: Ihar Hrachyshka <[email protected]>
This helps isolating system-wide zsh instance running in tests from the broader system shell initialization for limited nix environments.
This fixes failures as reported here:
NixOS/nixpkgs#312692