我在我的 nix-darwin 中设置了这样的家庭管理器。
除了 shellAliases 部分之外,一切都运行良好。
# 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";
};
};
软件包正在运行,但别名不起作用。
可能是什么问题?
您可能应该在您使用的确切 shell 部分中指定别名。就我而言,
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";
};
};
# ...