From 9b64eda0f5a9c72c1a74c112a4f95b45b282e337 Mon Sep 17 00:00:00 2001 From: Tim McCarthy Date: Fri, 2 Sep 2022 14:17:04 -0700 Subject: [PATCH] Add fish module to nix --- archive/fish/config.fish | 12 ++----- archive/fish/functions/ensure_path.fish | 7 ---- nix/home.nix | 5 ++- nix/modules/fish/default.nix | 45 +++++++++++++++++++++++++ 4 files changed, 50 insertions(+), 19 deletions(-) delete mode 100644 archive/fish/functions/ensure_path.fish create mode 100644 nix/modules/fish/default.nix diff --git a/archive/fish/config.fish b/archive/fish/config.fish index 610e5a8..00d3dd2 100644 --- a/archive/fish/config.fish +++ b/archive/fish/config.fish @@ -1,3 +1,4 @@ + # ============ # Basics, etc… # ============ @@ -8,10 +9,8 @@ set -g -x ALTERNATE_EDITOR "vim" set -g -x TERMINAL "kitty" # Setup PATH -ensure_path ~/.dotfiles/bin -ensure_path ~/.local/bin -ensure_path ~/bin -ensure_path ~/.emacs.d/bin +fish_add_path --path ~/.dotfiles/bin ~/.local/bin ~/bin +fish_add_path ~/.emacs.d/bin # Disable Fish greeting banner set --universal fish_greeting @@ -42,8 +41,3 @@ if test "$TERM" = "dumb" function fish_greeting; end function fish_title; end end - -# Starship prompt -if which starship &> /dev/null - starship init fish | source -end diff --git a/archive/fish/functions/ensure_path.fish b/archive/fish/functions/ensure_path.fish deleted file mode 100644 index 4af8c6d..0000000 --- a/archive/fish/functions/ensure_path.fish +++ /dev/null @@ -1,7 +0,0 @@ -function ensure_path --description "Ensures directories are in $PATH" - for pathdir in $argv - if not set -l index (contains -i $pathdir $PATH) - set -g -x PATH $pathdir $PATH - end - end -end diff --git a/nix/home.nix b/nix/home.nix index 4c16ea7..9994ebb 100644 --- a/nix/home.nix +++ b/nix/home.nix @@ -11,16 +11,14 @@ targets.genericLinux.enable = pkgs.stdenv.isLinux; home.packages = with pkgs; [ - # Defined in Xonsh overlay xonsh_with_plugins - # Jump to directories - zoxide # Better cat bat # Better find fd # Better df duf + # Better top htop fzf ncdu @@ -34,6 +32,7 @@ ]; imports = [ + ./modules/fish ./modules/git.nix ./modules/direnv.nix ./modules/emacs.nix diff --git a/nix/modules/fish/default.nix b/nix/modules/fish/default.nix new file mode 100644 index 0000000..9b9b4cb --- /dev/null +++ b/nix/modules/fish/default.nix @@ -0,0 +1,45 @@ +{ config, lib, pkgs, ... }: +{ + programs.zoxide = { + enable = true; + enableFishIntegration = true; + options = ["--cmd j"]; + }; + + programs.fish = { + enable = true; + + shellInit = '' + set --universal fish_greeting + set -g -x EDITOR "emacsclient" + set -g -x ALTERNATE_EDITOR "vim" + set -g -x TERMINAL "kitty" + set -g -x MANPAGER less -x + + fish_add_path --path ~/.dotfiles/bin ~/.local/bin ~/bin + + # TODO - Adjust for nix-managed Doom if I ever do that + fish_add_path ~/.emacs.d/bin + ''; + + shellAliases = { + ec = "emacsclient -n --alternate-editor=emacs"; + pubip = "curl icanhazip.com"; + src = "source ~/.config/fish/config.fish && clear"; + redesktop = "kquitapp5 plasmashell && kstart5 plasmashell"; + pulsefix = "pulseaudio --kill; pulseaudio --start"; + }; + }; + + # TODO -- port from Xonsh config + # $MANPAGER = "less -X" + # $LESS = "--ignore-case --QUIET --RAW-CONTROL-CHARS" + # + # + # if $TERM == "xterm-kitty": + # # Wrap ssh with environment variable because servers tend to deal poorly with kitty + # def xterm_ssh(args): + # $TERM="xterm-256color" ssh @(args) + # + # aliases["ssh"] = xterm_ssh +}