I am following the example in https://nixos.wiki/wiki/Zsh for zsh configured using Home Manager. The example uses zplug to configure powerlevel10k for repeated use. The p10k configuration cannot be saved because ~/.zshrc is a read-only link.
Steps to reproduce
My configuration.nix and home.nix build fine. When I open a terminal after adding the zplug example, the zsh shell tries to do a p10k configure, which runs perfectly until it tries to save the updates to ~/.zshrc
~/.zshrc is read-only, and is a symbolic link to /nix/store/bi54nzg6fwr44jby9j9bpzmg870sb7j2-home-manager-files/.zshrc
So how is p110k supposed to save my configuration? Why isn’t the example running as expected?
Happy to post my configuration if needed. I am following the example closely.
Cheers…
My environment
I am in a standalone VMware VM running NixOS with desktop from the full ISO,
p10k is not supposed to save to your shells RC file directly, and when I updated p10k for the last time, it happily suggested to manually add some commands to my zshrc, as it was RO.
You could follow that advice using HMs programs.zsh.extraInit or so like Janik does.
Alternatively you can put everything in zsh-plugins, as I do:
Here p10k-config is a folder beside the nix file which contains nothing but the p10k.zsh.
Thanks very much!
I used to work with the ENVY/Manager Smalltalk system 30 years ago. It was a very powerful configuration management system with an immutable model. It worked very much like nix does. Enjoying nix very much…
Thanks for your help!
It makes complete sense that RC files are immutable. It’s a bit of a problem that the Home Manager example from the wiki ignores how to deal with that. It’s a very good use-case - just needs to be fully worked. I don’t know enough yet to update any documentation.
Remembering I’ve only got a few hours on NixOS…
Yes, the page does cover zsh in the context of Home Manager.
I was stumped because I didn’t understand how fix a plugin that insists on writing to ~/.zshrc. Given that example is from the wiki page, it would be nice if it mentioned this difficulty, and suggested a resource to learn how to fix it.
Plugins monkeying with configuration files should be a frequent problem, so I think it’s something to learn how to deal with early. I may be struggling with something obvious to someone with more NixOS experience.