Help with ZSH and git prompt

Hello!

I am new to Nix and NixOS, I am writing my config for the first time. I also have a macOS laptop and eventually I would like to be able to use my home-manager config there too. For now, I am just setting up NixOS.

I am using ZSH on NixOS and I have a custom theme that I wrote. Its compatible with oh-my-zsh and it uses a git prompt when a git repository is detected. This theme works fine on macOS with the ZSH git plugin enabled.

On NixOS, the git prompt does not show up even though the theme loads. I am not sure what is causing the error. Here is my nix config (/etc/nixos): GitHub - jjmarchewitz/nixos: My NixOS config

Is there anything obvious that sticks out as an issue? If you wouldn’t mind, I would also like to know how you came to your conclusion of what the issue was so I can learn to debug these things on my own.

Thank you!

The theme probably loads because its just a theme, a full plugin would probably need to be directly declared as part of the zsh options set.

Check:NixOS Search
This likely exactly what your missing to import a plugin.

You should also take a look at the zsh drv source code available from the repo for some hints as to what to give the config to make it work as intended.

To expand on this a bit so it makes more sense:

Nix as a language can be boiled down to “everything is a function, and functions are immutable”
macOS and pretty much every linux distro save Nix itself is not declarative, they are imperative.

For things you’d typically only need as part of a graphic set, icon maybe, little stuff you could drop in imperatively.

Others like plugins that modify the functionality, and more importantly the nix-store hash of the drv would need to be declared directly so the drv gets rebuilt, and a new hash calculated. This is how nix’s version control was designed to work.
A function thats not being called cant execute. You defined the function for the zsh plugin but didnt call it in any options for zsh at the top level.

Looking through the NixOS search I think I am using the correct arguments:

This argument from the zsh options is what I am using: NixOS Search

Not sure why I didn’t try this before but when I use other themes, git works. I wrote my own zsh theme and I assumed that because it worked on macOS it would work on NixOS. I guess I have to tweak it. Thank you for the help anyway!

Glad its all worked out.