6

So I’m trying to make a development environment that’s easily reproducible (staying away from home-manager currently to understand Nix better). After enough searching around I figured out how to make a few custom derivations, use buildEnv for package sets, and use ~/.config/nixpkgs/config.nix to do overrides. I’m working now to setup zsh and oh-my-zsh which have a ton of configuration options, but the only documentation I can find seems to suggest adding them to configuration.nix, which is a NixOS option I can’t use.

Currently my config.nix code looks something like this:

let 
  pkgs = import <nixpkgs> {};
in {
  allowUnfree = true;

  programs = {
      zsh = {
        enable = true;
        promptInit = "source ${pkgs.zsh-powerlevel9k}/share/zsh-powerlevel9k/powerlevel9k.zsh-theme";
        ohMyZsh = {
            enable = true;
            plugins = ["autojump"];
            theme = "powerlevel9k/powerlevel9k";
        };
      };
  };

  packageOverrides = pkgs: with pkgs; rec {
    all = buildEnv {
      name = "all";
      paths = with pkgs; [
        tmuxinator
        zsh
        oh-my-zsh
        autojump
        ...
      ];
    };
  };
}

My understanding so far is that within ~/.config/nixpkgs/config.nix, there should be a single config set which contains things like the overrides function and corresponds to documentation examples of config.programs.zsh.enable, etc. However, nothing I write in that programs section affects or causes a different ouput of any of my programs.

What am I missing? How can I affect the configuration options listed here (https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/programs/zsh/zsh.nix)?

Anrothan
  • 500
  • 5
  • 13

1 Answers1

2

You seem to be trying to use home-manager's config without using home-manager itself. As you can see in the NixOS module you linked, this actually sets up /etc/zshrc etc, so it's not intended for use in a user-local config and won't do anything there. If you look at the corresponding home-manager module, you'll see that it basically reimplements the whole module for user-local purposes. So you won't get far with this approach without relying on home-manager.

Sebastian Ullrich
  • 1,170
  • 6
  • 10