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

zsh: fix zprofile configure flag #52718

Merged
merged 1 commit into from Jan 8, 2019
Merged

Conversation

furrycatherder
Copy link
Contributor

@furrycatherder furrycatherder commented Dec 23, 2018

This doesn't work on distros like Gentoo that put zprofile under
/etc/zsh. We have overrideAttrs now, too, so the obvious solution would
be overriding configureFlags, but then preConfigure would override on top
of that…
Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@hedning
Copy link
Contributor

hedning commented Dec 23, 2018

It seems like the problem is configureFlags not being overridable, not the shim. This is probably much better dealt with like this:

modified   pkgs/shells/zsh/default.nix
@@ -34,10 +34,8 @@ stdenv.mkDerivation {
     "--enable-multibyte"
     "--with-tcsetpgrp"
     "--enable-pcre"
+    "--enable-zprofile=${placeholder "out"}/etc/zprofile"
   ];
-  preConfigure = ''
-    configureFlagsArray+=(--enable-zprofile=$out/etc/zprofile)
-  '';
 
   # the zsh/zpty module is not available on hydra
   # so skip groups Y Z

@furrycatherder
Copy link
Contributor Author

As long as we're making --enable-zprofile actually overridable (without the messy preConfigure = null), that kind of obviates the need for a shim, doesn't it? Everything it's doing is the default behavior of zsh except for conditionally sourcing /etc/profile on NixOS only. And it seems like the real problem there is that NixOS users can have shell = pkgs.zsh without also having config.programs.zsh = enable... maybe that's what really needs to be fixed.

My thought is that NixOS-specific stuff should be moved into nixos/ somehow. I don't know whether that's the prevailing opinion but the XXX: think/discuss about this... is from 2011 so it could be time to revisit that conversation.

@hedning
Copy link
Contributor

hedning commented Dec 23, 2018

As long as we're making --enable-zprofile actually overridable (without the messy preConfigure = null), that kind of obviates the need for a shim, doesn't it?

I don't really see how configureFlags being easily overridable has that much to do with the shim. As you note the purpose is making sure zsh have a workable environment in the absence of /etc/zprofile on nixos. While this probably isn't extensively used, it is possible to hit it without misconfiguring the users shell. In general running zsh from a bare bones environment (eg. cron could be such a case I believe).

The shim have been there a long time, which means there's most likely users relying on the behavior. So while I wouldn't be eager to add the functionality today, removing it now, without a replacement, isn't great either.

In the end making configureFlags easily overridable should be uncontroversial and address your main concerns. Removing the shim carries the risk of breaking existing users while the upside is mostly having a shorter/cleaner zsh derivation (the maintenance burden looks trivial to me, not requiring any changes since its introduction in 2011).

@furrycatherder furrycatherder changed the title zsh: delete zprofile shim zsh: fix zprofile configure flag Dec 23, 2018
Copy link
Contributor

@hedning hedning left a comment

Choose a reason for hiding this comment

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

👍

@hedning hedning merged commit 68982ea into NixOS:master Jan 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants