How can I customize ZSH theme w/ NixOS?

I’m using NiXOS+Home Manager, I use zsh and I’d like to use a custom theme, custom.zsh-theme.

In non-NixOS-land this means placing the theme file in $HOME/. oh-my-zsh/themes, then setting $ZSH_THEME to, in this case, “custom”.

But in NixOS, this directory points to the read-only path /nix/store/.../oh-my-zsh/....

How do I do it?

Have you tried using programs.zsh.ohMyZsh.theme?

Ok, so let’s say I do programs.zsh.ohJMyZsh.theme = "custom". It’s going to complain because “custom” doesn’t exist, right? How do I get my custom theme into the themes directory?

I don’t know (because I don’t use zsh and have never used ohmyzsh or home-manager) but:

  1. HM already appears to have an option for customizing ohmyzsh
  1. ohmyzsh already has a theme customization subsection on their wiki

  2. A github code search turns up multiple ways others are already using this, including:

https://github.com/maxdevjs/dotfiles-nixos/blob/bf32db080e5a8f802c383f06aa9b9e6714d26e7a/shells/zsh.nix#L14-L17
and

1 Like

This worked. Thank you for helping me love NixOS!

1 Like