How to add extra text to .zshrc?

I used to do following in home manager configuration:

{ pkgs, ...}: {
  programs = {
    home-manager.enable = true;
    zsh = {
     enable = true;
      oh-my-zsh = { SOME CFG };
      shellAliases = { SOME CFG };
    };
  };
  home.file.".zshrc".text = ''
    eval "$(starship init zsh)"
    SOME SOURCING, ETC
  '';

This worked until today I updated home manager, and it told me this is conflicting since same file is touched in two places.

Searching NixOS Options does not give me an alter option. What should I do with the “text” part?

Add your code to programs.zsh.initContent?

I could not find it here. Maybe programs.zsh.interactiveShellInit? What if I want something done after other configs?

That link only shows nixos options. programs.zsh.initContent is a home-manager option. You can see those here or by running man home-configuration.nix.

1 Like