Varun Gawande
Varun Gawande

Reputation: 1120

home.shellAliases unable to set aliases using home-manager

I have set up home-manager like this inside my nix-darwin.
Every thing is working perfectly except for the shellAliases part.

  # Home Manager configurations
  imports = [ <home-manager/nix-darwin> ];

  users.users.<user> = {
    name = "<user>";
    home = "/Users/<user>";
  };

  home-manager.users.<user> = { pkgs, ... }: {
    home = {
      shellAliases = {
          asl = "aws sso login";
      };
      packages = with pkgs; [
        btop
        direnv
        gh
        neovim
        nixfmt
        tree
        zoxide
        bat
        lazygit
        delta
        ripgrep
        cargo
        speedtest-cli
      ];
      stateVersion = "22.05";
    };
  };

The packages are working, but the alias is not.
What could be the issue?

Upvotes: 5

Views: 1248

Answers (1)

alexdao108
alexdao108

Reputation: 139

You probably should specify aliases in the section of the exact shell you use. In my case with zsh:

 # ....

 programs.zsh = {
        enable = true;
        enableCompletion = true;
        enableAutosuggestions = true;
        autocd = true;
        syntaxHighlighting.enable = true;
        
        plugins = [
            {
                name = "powerlevel10k";
                src = pkgs.zsh-powerlevel10k;
                file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme";
            }
            {
                name = "powerlevel10k-config";
                src = ./../configs/p10k;
                file = "p10k.zsh";
            }
        ];

        shellAliases = {
            ll = "eza -l";
            la = "eza -la";
        };
 };

# ...

Upvotes: 0

Related Questions