Difficult to make git work with zsh and oh my zsh

Hi everyone.

I’m trying to configure zsh and oh-my-zsh using nix / home-manager and flakes.

This is my current home.nix

{ config, pkgs, ... }:

  # Home Manager needs a bit of information about you and the paths it should
  # manage.
  home.username = "username";
  home.homeDirectory = "directory";

  home.stateVersion = "24.05";

  # The home.packages option allows you to install Nix packages into your
  # environment.
  home.packages = [

  home.file = {
   ".gitconfig".source = ./gitconfig;
   ".zshrc" = {
      source = ./zshrc;
      executable = true;
   ".vimrc".source = ./vimrc;

  home.sessionVariables = {
    EDITOR = "vim";

  programs.zsh.enable = true;
  programs.vim.enable = true;
  programs.lazygit.enable = true;
  programs.git.enable = true;
  programs.autojump.enable = true;
  programs.home-manager.enable = true;

This packages git and autojump it’s not working as I expected.
When I on zsh shell at git directory and try to use the command gst (an alias in oh-my-zsh), that doesn’t work too.

zsh: command not found: gst

The same occurs when try to use autojump

zsh: command not found: j

I really like to use my .zshrc that was sourced on home.nix to deal with my shell configuration, is that even possible?

Or I need to configure my zsh directly on home.nix?

Ps: I’m using Ubuntu

Hard to say since we don’t know what you do in your .zshrc, i.e., set all the PATH variables correctly.

Sorry @polygon, here is my .zshrc: dotfiles/zshrc at 3af40c470f2be7bca872b3c4306130984369d972 · jtlimo/dotfiles · GitHub

while you might be able to source ohmyzsh like you did in your zshrc, I have

zsh.oh-my-zsh.enable = true;

in my home.nix like so:

    zsh = {
      initExtra = ". ~/.zshrc.thoth";
      enable = true;
      enableCompletion = true;
      #autosuggestion.enable = true;
      syntaxHighlighting.enable = true;
      shellAliases = {
        ll = "ls -l";
        vi  = "lvim";
        vim = "lvim";
        kubectl = "kubecolor";
      history.size = 20000;
      history.path = "/home/thoth/.zsh_history";
      oh-my-zsh = {
        enable = true;
        plugins = [ "git" "python" "man" "kubectl" ];
        theme = "random";

though admittedly autosuggestion is commented as it has never worked for me.