nix-configuration/home-manager/common.nix
2025-01-07 15:00:13 +01:00

51 lines
943 B
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
'';
};
}