nix-configuration/home-manager/common.nix

56 lines
1.1 KiB
Nix

{
lib,
pkgs,
...
}:
let
zshSourceCommon = ./zsh/common;
isDarwin = pkgs.stdenv.hostPlatform.isDarwin;
isLinux = pkgs.stdenv.hostPlatform.isLinux;
in
{
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
programs.bat = {
enable = true;
};
programs.zsh = {
enable = true;
autocd = lib.mkDefault true;
shellAliases =
{
cat = lib.mkDefault "bat --paging=never";
nixfix = lib.mkDefault "nix fmt ./**/*.nix";
}
// (
if isDarwin then
{
hm-switch = lib.mkDefault "darwin-rebuild switch --flake ~/.config/nix";
}
else if isLinux then
{
hm-switch = lib.mkDefault "home-manager switch --flake ~/.config/nix";
}
else
{ }
);
initExtra = ''
for file in ${zshSourceCommon}/*.zsh; do
source "$file"
done
# [Ctrl-RightArrow] - move forward one word
bindkey '^[[1;3C' forward-word
# [Ctrl-LeftArrow] - move backward one word
bindkey '^[[1;3D' backward-word
'';
};
}