Oh-my-zsh complains about missing ~/.zshrc


I’m totaly new to Nix and NixOS, but are trying to learn and test NixOS out.
I have follow the manual about setting up Oh-My-Zsh: NixOS - NixOS 21.05 manual

But everytime I log into Nixos I get a notification from Oh-My-Zsh: “You are seeing this message because you have no zsh startup files”.
But apart from that message Oh-my-zsh seems to be working.

But why do I get that notification? I thought Nix would create the startup files based on configuration.nix?

Here is my configuration.nix file (whitout the boot-settings stuff):

# List packages installed in system profile. To search, run:
  # $ nix search wget
  environment.systemPackages = with pkgs; [
    vim git tmux zsh oh-my-zsh

  # Some programs need SUID wrappers, can be configured further or are
  # started in user sessions.
  # programs.mtr.enable = true;
  # programs.gnupg.agent = { enable = true; enableSSHSupport = true; };
  programs.zsh.enable = true;
  programs.zsh.ohMyZsh = {
    enable = true;
    plugins = [ "git" "tmux" ];

(I’m also not shure if I need/should include zsh and oh-my-zsh in the systemPackages.)

Really would appreciate some help/input because I’m looking forward to testing NixOS out.


AFAIK NixOS populate everything based on your configuration, except /home and /var, i.e. files under ~ will not be setup automatically by NixOS.

Is there a way to get zsh to stop complaining about the lack of ~/.zshrc?

The message disappears if you create an empty ~/.zshrc.
Not shure if that can interfere with the nix configuration.

The NixOS manual states:

The expression generates the needed configuration and writes it into your /etc/zshrc .

That sounds like I shouldn’t need to create/handle any config files outside of configuration.nix.

Yeah, that’s what I’ve done. I was just wondering if there was a setopt or similar that one could set.

FWIW you can remove zsh and oh-my-zsh from environment.systemPackages since you’re using the modules (those will set up system packages as necessary).

In any case, I know you’re configuring it in your NixOS configuration, but does that mean there’s legitimately no need for ~/.zshrc? Would that file not be used for additional per-user configuration? Though it is odd that oh-my-zsh would complain about no configuration at all if the system-level configuration is set up.

Perhaps the NixOS module should use a patched version of oh-my-zsh that disables that warning. Though that would then potentially cause issues if you include oh-my-zsh in systemPackages. Though the patched version could do something like look for a specific env var that indicates that it was set up via a module and disable it in that case, and then the oh-my-zsh module could set that env var in its programs.zsh.interactiveShellInit definition.