{ pkgs, ... }: let nixConfigDirectory = "~/dotfiles.nix"; in { imports = [ ./extras/fish/auto-theme.nix ]; programs.fish = { enable = true; autoTheme = { enable = true; light = "rose-pine-dawn"; dark = "rose-pine"; }; # see flake.nix and pkgs/default.nix plugins = pkgs.fishPlugins.flakePlugins; functions = { # user functions mkdcd = { argumentNames = [ "target" ]; body = '' if test -z "$target" echo "mkdcd requires an argument" 1>&2 return 1 end mkdir -p $target cd $target ''; }; from-dir = { argumentNames = [ "dir" ]; body = '' pushd $dir set -e argv[1] $argv popd ''; }; darwin-rebuild-edit-with = { argumentNames = [ "editor" "file" ]; body = '' if test -z "$file" set file flake.nix end from-nix $editor $file ''; }; # TODO: use these to implement !! and .. abbreviations # blocked on additional support for abbr in home-manager # https://github.com/nix-community/home-manager/issues/3706 # # taken from # https://fishshell.com/docs/current/relnotes.html#fish-3-6-0-released-january-7-2023 # last-history-item.body = '' # echo $history[1] # ''; # multi-cd.body = '' # echo cd (string repeat -n (math (string length -- $argv[1]) - 1) ../) # ''; }; shellAbbrs = { ".." = "cd .."; # darwin-rebuild build drb = "from-nix darwin-rebuild build --flake ."; # darwin-rebuild switch full drsf = "from-nix darwin-rebuild switch --flake ."; # darwin-rebuild switch (no homebrew) drs = "from-nix darwin-rebuild switch --flake . --override-input homebrew-enabled github:boolean-option/false"; # edit darwin-rebuild config in helix drh = "darwin-rebuild-edit-with hx"; # edit darwin-rebuild config in zed drz = "zed ${nixConfigDirectory}"; nb = "nix build"; nd = "nix develop"; nf = "nix flake"; nfc = "nix flake check"; nfi = "nix flake init"; nfs = "nix flake show"; nfu = "nix flake update"; nr = "nix run"; ns = "nix search nixpkgs"; nsh = "nix shell"; nrp = "nix repl --expr '{ pkgs = (import { }); }'"; g = "git"; ga = "git add"; gc = "git commit"; gd = "git diff"; gl = "git log"; gp = "git push"; stage = "git add ."; commit = "git commit"; push = "git push"; pull = "git pull"; }; shellAliases = { # nix related from-nix = "from-dir ${nixConfigDirectory}"; # other ":q" = "exit"; cat = "bat --style=plain --paging=never"; du = "dust"; http = "xh"; https = "xhs"; top = "btm"; htop = "btm --basic"; colortest = "terminal-colors -o"; }; # configuration that should be above `loginShellInit` and `interactiveShellInit`. shellInit = '' set -U fish_term24bit 1 ''; interactiveShellInit = '' set -g fish_greeting (set_color red)"(づ ̄ ³ ̄)づ"(set_color yellow)" hello "(set_color blue)"(づ ̄ ³ ̄)づ"(set_color normal) fish_vi_key_bindings ''; }; home.sessionVariables.VIRTUAL_ENV_DISABLE_PROMPT = "true"; }