Trying to setup zsh with OMZ and p10k

Hello,

new Nix user here so please be patient with me :slight_smile:

I have been using zsh with ohmyzsh and powerlevel10k for a while now and wanted to port it over to my new nixos setup, but all the guides and wiki entries and forum posts lead me to roadblocks I am confused about. In the sake of learning I will elaborate on the path I went down on and the questions that came up during that.

I started with the page on Zsh - NixOS Wiki and the first example config throws a big error, referencing while evaluating the error message for definitions for `programs.zsh.history', which is an option that does not exist which is already confusing, but removing the history key worked. It was confusing because its clearly defined in Appendix A. Configuration Options and https://github.com/nix-community/home-manager/blob/6a94c1a59737783c282c4031555a289c28b961e4/modules/programs/zsh.nix#L358-L362

Then I was following conversations like Zsh zplug powerlevel10k ~/.zshrc is readonly and the same is happening for the plugins config option: error: The option `programs.zsh.plugins' does not exist. Definition values: which again is clearly specified in Appendix A. Configuration Options and https://github.com/nix-community/home-manager/blob/6a94c1a59737783c282c4031555a289c28b961e4/modules/programs/zsh.nix#L420

I also found out that I don’t have to specify zsh as a package to be installed as long as I have programs.zsh.enable = true set.

I was then looking at a few nixos config repositories like https://github.com/NobbZ/nixos-config/blob/c6bf918ef5609719e2627cee483072a3c35fc137/home/modules/programs/p10k/default.nix#L17-L28 and trying to apply their configs, but with the same results that the plugins config option is not set.

I was then wondering if that option is only valid if you have specific things imported or enabled? But none of the configs from people who graciously share them publicly seem to have a section of the packages they import, maybe they do that dynamically, but as a new user its hard to really follow this.

So now I am confused why these config options are not available when they are clearly documented, and if I am missing something that I do different then everyone else?

I just install packages with

  environment.systemPackages = with pkgs; [
    [...trimmed]
    zsh
    zsh-powerlevel10k
  ];

but none of the public config repos I found do things this way, making it hard to reproduce what they are doing.

Any help, links to documentation and education is much appreciated!

Regards,
Marvin

The links provided are for home-manager, while your config snippet is system configuration. Where the plugin option indeed is not available.

If you do not want to use HM, you have to either impurely throw random files into your home as you did before, or you need to implement what HM does, but for the system wide shell configuration.

PS: My ZSH configuration is not compatible with OMZ, HMs OMZ plugin thing works different from the vanilla plugin thing. In general there is no real need for OMZ, HM can manage the plugins as well, and there is no unique feature to OMZ.

2 Likes

Ohhh that makes so much sense now!

I see that I can use home manager as part of my main config, which for my system being a single user one anyway would work well as its all in one place then :slight_smile: