From a7102b5b679770fedaa63958e4022d1dd91c208a Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Fri, 16 Jun 2023 20:17:51 -0400 Subject: [PATCH] fish: Move user config to ./home --- home/fish.nix | 53 +++++++++++++++++++++++++++++++++++++++++++++ modules/fish.nix | 56 ------------------------------------------------ 2 files changed, 53 insertions(+), 56 deletions(-) create mode 100644 home/fish.nix diff --git a/home/fish.nix b/home/fish.nix new file mode 100644 index 00000000..d60f5c70 --- /dev/null +++ b/home/fish.nix @@ -0,0 +1,53 @@ +{ + xdg.configFile."fish/config.fish".text = /* fish */ '' + set -U fish_greeting "" + + export PATH="$HOME/.deno/bin:$HOME/.cargo/bin:$HOME/.yarn/bin:$HOME/.local/bin:$HOME/.go/bin:$PATH" + export GOPATH="$HOME/.go" + export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket" + export TERMCMD="kitty --single-instance" + + # Required to make gpg-agent work in cases like git commit + export GPG_TTY=(tty) + + # Add color to man pages + set -x -U LESS_TERMCAP_md (printf "\e[01;31m") + set -x -U LESS_TERMCAP_me (printf "\e[0m") + set -x -U LESS_TERMCAP_se (printf "\e[0m") + set -x -U LESS_TERMCAP_so (printf "\e[01;44;30m") + set -x -U LESS_TERMCAP_ue (printf "\e[0m") + set -x -U LESS_TERMCAP_us (printf "\e[01;32m") + + # Always use the default keybindings in fish + fish_default_key_bindings + + # Convert unnecessarily large wav files to flac + function wav2flac + set ORIGINAL_SIZE (du -hs | cut -f1) + + fd -e wav -x ffmpeg -i "{}" -loglevel quiet -stats "{.}.flac" + fd -e wav -X trash + + set NEW_SIZE (du -hs | cut -f1) + + echo "Done. Reduced file size from $ORIGINAL_SIZE to $NEW_SIZE" + end + + # Convert wav/flac to opus + function opus + set ORIGINAL_SIZE (du -hs | cut -f1) + + fd -e wav -e flac -x ffmpeg -i "{}" -c:a libopus -b:a 128K -loglevel quiet -stats "{.}.opus" + fd -e wav -e flac -X rm -I + + set NEW_SIZE (du -hs | cut -f1) + + echo "Done. Reduced file size from $ORIGINAL_SIZE to $NEW_SIZE" + end + + # Always use kitty ssh since it's our default terminal + if string match -qe -- "/dev/pts/" (tty) + alias ssh="kitty +kitten ssh" + end + ''; +} diff --git a/modules/fish.nix b/modules/fish.nix index b2814c6c..4ae86ec4 100644 --- a/modules/fish.nix +++ b/modules/fish.nix @@ -84,60 +84,4 @@ let VARIABLES = import ../src/variables.nix; in { t = "tree"; }; }; - - home-manager.sharedModules = [ - { - xdg.configFile."fish/config.fish".text = /* fish */ '' - set -U fish_greeting "" - - export PATH="$HOME/.deno/bin:$HOME/.cargo/bin:$HOME/.yarn/bin:$HOME/.local/bin:$HOME/.go/bin:$PATH" - export GOPATH="$HOME/.go" - export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket" - export TERMCMD="kitty --single-instance" - - # Required to make gpg-agent work in cases like git commit - export GPG_TTY=(tty) - - # Add color to man pages - set -x -U LESS_TERMCAP_md (printf "\e[01;31m") - set -x -U LESS_TERMCAP_me (printf "\e[0m") - set -x -U LESS_TERMCAP_se (printf "\e[0m") - set -x -U LESS_TERMCAP_so (printf "\e[01;44;30m") - set -x -U LESS_TERMCAP_ue (printf "\e[0m") - set -x -U LESS_TERMCAP_us (printf "\e[01;32m") - - # Always use the default keybindings in fish - fish_default_key_bindings - - # Convert unnecessarily large wav files to flac - function wav2flac - set ORIGINAL_SIZE (du -hs | cut -f1) - - fd -e wav -x ffmpeg -i "{}" -loglevel quiet -stats "{.}.flac" - fd -e wav -X trash - - set NEW_SIZE (du -hs | cut -f1) - - echo "Done. Reduced file size from $ORIGINAL_SIZE to $NEW_SIZE" - end - - # Convert wav/flac to opus - function opus - set ORIGINAL_SIZE (du -hs | cut -f1) - - fd -e wav -e flac -x ffmpeg -i "{}" -c:a libopus -b:a 128K -loglevel quiet -stats "{.}.opus" - fd -e wav -e flac -X rm -I - - set NEW_SIZE (du -hs | cut -f1) - - echo "Done. Reduced file size from $ORIGINAL_SIZE to $NEW_SIZE" - end - - # Always use kitty ssh since it's our default terminal - if string match -qe -- "/dev/pts/" (tty) - alias ssh="kitty +kitten ssh" - end - ''; - } - ]; }