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

nix-2.4 conflicts with programs.zsh.enable #5445

Open
spease opened this issue Oct 28, 2021 · 16 comments
Open

nix-2.4 conflicts with programs.zsh.enable #5445

spease opened this issue Oct 28, 2021 · 16 comments
Labels

Comments

@spease
Copy link

spease commented Oct 28, 2021

Describe the bug

building the system configuration...
these derivations will be built:
  /nix/store/f757qsid5bpw9y1sd3mi98yvlhdk6279-org.nixos.nix-gc.plist.drv
  /nix/store/xp0ccm8sva8xr3dghvikck6hfikqhr9h-org.nixos.nix-daemon.plist.drv
  /nix/store/99i8h30phs0zshnrlhmc3phmf93jz2gy-launchd.drv
  /nix/store/m0ssv6jkvbx2qv4byzc2f25zfbfdrysj-darwin-rebuild.drv
  /nix/store/hqd1jv9lp2y1x4g5dxkhqqsw3w366a5z-system-path.drv
  /nix/store/ny7vfsbqr35wzalhdgfhdyrx4xa3q52q-system-applications.drv
  /nix/store/llharndqwpji8j6f1gwhf5n2ln29c9d5-darwin-system-21.11pre325512.22a500a3f87+darwin4.0000000.drv
building '/nix/store/m0ssv6jkvbx2qv4byzc2f25zfbfdrysj-darwin-rebuild.drv'...
building '/nix/store/xp0ccm8sva8xr3dghvikck6hfikqhr9h-org.nixos.nix-daemon.plist.drv'...
building '/nix/store/f757qsid5bpw9y1sd3mi98yvlhdk6279-org.nixos.nix-gc.plist.drv'...
building '/nix/store/99i8h30phs0zshnrlhmc3phmf93jz2gy-launchd.drv'...
building '/nix/store/ny7vfsbqr35wzalhdgfhdyrx4xa3q52q-system-applications.drv'...
building '/nix/store/hqd1jv9lp2y1x4g5dxkhqqsw3w366a5z-system-path.drv'...
created 3 symlinks in user environment
error: collision between `/nix/store/475pa4h5rd6289zm8iga507ppl3k9zwn-nix-2.4pre-rc1/share/zsh/site-functions/_nix' and `/nix/store/2ssnzzjz8pqxcl3jv9sbcphiqsrxd8x3-nix-zsh-completions-0.4.4/share/zsh/site-functions/_nix'
builder for '/nix/store/hqd1jv9lp2y1x4g5dxkhqqsw3w366a5z-system-path.drv' failed with exit code 25
cannot build derivation '/nix/store/llharndqwpji8j6f1gwhf5n2ln29c9d5-darwin-system-21.11pre325512.22a500a3f87+darwin4.0000000.drv': 1 dependencies couldn't be built
error: build of '/nix/store/llharndqwpji8j6f1gwhf5n2ln29c9d5-darwin-system-21.11pre325512.22a500a3f87+darwin4.0000000.drv' failed

Steps To Reproduce

Set nix.package to pkgs.nix_2_4 with programs.zsh.enable = true;

Expected behavior

nix

nix-env --version output

Additional context

@spease spease added the bug label Oct 28, 2021
@spease spease changed the title nix-2.4 conflicts with nix-2.4 conflicts with programs.zsh.enable Oct 28, 2021
@Enzime
Copy link
Member

Enzime commented Oct 28, 2021

Nixpkgs checks the Nix version and patches nix-zsh-completions:

https://github.com/NixOS/nixpkgs/blob/0699530f08290f34c532beedd66046825d9756fa/nixos/modules/programs/zsh/zsh.nix#L286-L300

While nix-darwin and home-manager do not:

https://github.com/LnL7/nix-darwin/blob/a7492a8c76dcc702d0a65cd820a5f9baa8702684/modules/programs/zsh/default.nix#L103
https://github.com/nix-community/home-manager/blob/master/modules/programs/zsh.nix#L447

Maybe it would be a better idea to change the derivation for nix-zsh-completions so that the downstream modules don't have to handle this complexity.

@spease
Copy link
Author

spease commented Oct 28, 2021

The home-manager approach is also the only one described in the wiki:
https://nixos.wiki/wiki/Zsh

@shroomist
Copy link

stumbled on this just now after upgrading to nix-2.4, had to manually do the patch that Enzyme mentioned.

@ahmedelgabri
Copy link

@shroomist would you mind sharing what you exactly did?

@npajkovsky
Copy link

@shroomist I'm interested too.

@shroomist
Copy link

shroomist commented Nov 12, 2021

@ahmedelgabri @npajkovsky

  1. switched back to default nix (basically undo nix.package = pkgs.nixFlakes) so that rebuilding works.
  2. switched off programs.zsh.enableCompletion
  3. darwin-rebuild switch
  4. remove the conflicting file that was left over from programs zsh completions rm /nix/store/2ssnzzjz8pqxcl3jv9sbcphiqsrxd8x3-nix-zsh-completions-0.4.4/share/zsh/site-functions/_nix
  5. switch back the completions and pkgs.nixFlakes and rebuild

@ahmedelgabri
Copy link

Thanks @shroomist 👍🏼

I think the first step is not needed, instead, I removed nix-zsh-completion & disabled programs.zsh.enableCompletion

Then followed the rest of the steps.

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/resolving-conflicts-nix-2-4-nix-zsh-completion/16006/2

@spease
Copy link
Author

spease commented Nov 12, 2021

For pkgs.nix_2_4, I don't think you need to change pkgs.nixFlakes. Just disable completion, switch, remove the file, reenable completions, and switch.

@spease
Copy link
Author

spease commented Nov 12, 2021

Note also that I got:

error: not linking environment.etc."zshrc" because /etc/zshrc already exists, skipping...
existing file has unknown content d40c3b1aef347d29aa8a340937e281b132b3747a9f0018d50aa1119d7da33987, move and activ
ate again to apply

I checked that the pre-nix backup was the same and removed /etc/zshrc and that fixed that error.

@juev
Copy link

juev commented Nov 12, 2021

I have disabled completions:

  programs.zsh = {
    inherit shellAliases;
    enable = true;
    enableCompletion = false;

but switch id not working. I got error:

Converting contributing.adoc to DocBook ...
error: collision between `/nix/store/csadkv9vsi64sxx8nq08ydy88j3b3kwp-nix-2.4/share/zsh/site-functions/_nix' and `/nix/store/9aggbz1bcndl0la8b42y4ridwp7wgvwq-nix-zsh-completions-0.4.4/share/zsh/site-functions/_nix'
builder for '/nix/store/vppjhlz5l0miz8x7wnpc7ivl04cyz9iw-system-path.drv' failed with exit code 25
cannot build derivation '/nix/store/y8qwlfja3j3a00gghzfagzkid6c74rb8-darwin-system-21.11pre330079.bf346b557b7+darwin4.0000000.drv': 1 dependencies couldn't be built
error: build of '/nix/store/y8qwlfja3j3a00gghzfagzkid6c74rb8-darwin-system-21.11pre330079.bf346b557b7+darwin4.0000000.drv' failed

Trying to remove file:

sudo rm /nix/store/2ssnzzjz8pqxcl3jv9sbcphiqsrxd8x3-nix-zsh-completions-0.4.4/share/zsh/site-functions/_nix

it not helped.

update
I removed both files:

sudo rm /nix/store/csadkv9vsi64sxx8nq08ydy88j3b3kwp-nix-2.4/share/zsh/site-functions/_nix
sudo rm /nix/store/9aggbz1bcndl0la8b42y4ridwp7wgvwq-nix-zsh-completions-0.4.4/share/zsh/site-functions/_nix

after this switch was complete.

Azd325 added a commit to Azd325/dotfiles that referenced this issue Nov 16, 2021
Azd325 added a commit to Azd325/dotfiles that referenced this issue Nov 17, 2021
@luizribeiro
Copy link

Can we close this? I'm using nix 2.7 from unstable and am not running into this issue anymore.

@EncodePanda
Copy link

I have still this issue. I'm on nix 2.8

@daneov
Copy link

daneov commented Aug 23, 2022

Present on Ubuntu with Nix 2.10.3.

@seanybaggins
Copy link

I have the same issue as well

$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.13.0-valve21.3-1-neptune, SteamOS, noversion, 20221005.1`
 - multi-user?: `no`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.11.1`
 - channels(deck): `"home-manager, nixpkgs"`
 - nixpkgs: `/home/deck/.nix-defexpr/channels/nixpkgs`


@seanybaggins
Copy link

Following @spease's instructions also seamed to fix my issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests