home-manager: refactor fish

This commit is contained in:
Primrose 2024-11-30 12:55:13 +01:00
parent 2839b42a60
commit ce57f98630
Signed by: primrose
GPG key ID: 4E887A4CA9714ADA
2 changed files with 14 additions and 10 deletions

View file

@ -6,7 +6,7 @@
}:
{
programs.fish = {
shellAbbrs = lib.mkMerge [
shellAbbrs = lib.mergeAttrsList [
{
# Docker
dc = "docker compose";
@ -22,7 +22,7 @@
":q" = "exit";
}
(lib.mkIf pkgs.stdenv.isLinux {
(lib.optionalAttrs pkgs.stdenv.isLinux {
ssys = "sudo systemctl";
sys = "systemctl";
se = "SUDO_EDITOR=(which \$EDITOR) sudoedit";
@ -30,25 +30,25 @@
hswitch = "home-manager switch --flake ~/.dotfiles#${hostname}";
})
(lib.mkIf pkgs.stdenv.isDarwin {
(lib.optionalAttrs pkgs.stdenv.isDarwin {
nswitch = "darwin-rebuild switch -L --flake ~/.dotfiles#${hostname} --option sandbox false";
})
];
shellAliases = lib.mkMerge [
shellAliases = lib.mergeAttrsList [
{
rm = "rm -I"; # idiot protection
tree = "tree -Cph";
restow = "cd ~/.dotfiles/ && stow -D . && stow -S . && prevd";
}
(lib.mkIf pkgs.stdenv.isLinux {
(lib.optionalAttrs pkgs.stdenv.isLinux {
# idiot protection
chmod = "chmod --preserve-root";
chown = "chown --preserve-root";
})
(lib.mkIf pkgs.stdenv.isDarwin (
(lib.optionalAttrs pkgs.stdenv.isDarwin (
let
cmds = builtins.concatStringsSep ";";
in