nix-config/home/fish.nix

71 lines
2.4 KiB
Nix
Raw Normal View History

{ pkgs, ... }:
2024-04-06 04:51:24 +02:00
let
inherit (pkgs) gsettings-desktop-schemas prisma-engines gtk3;
in
2023-06-17 02:17:51 +02:00
{
programs.fish = {
enable = true;
2023-06-17 02:17:51 +02:00
shellInit = /* fish */ ''
set -U fish_greeting ""
2023-06-17 02:17:51 +02:00
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"
export XDG_DATA_DIRS="${gsettings-desktop-schemas}/share/gsettings-schemas/${gsettings-desktop-schemas.name}:${gtk3}/share/gsettings-schemas/${gtk3.name}:$XDG_DATA_DIRS"
export DIRENV_LOG_FORMAT=""
export PRISMA_SCHEMA_ENGINE_BINARY="${prisma-engines}/bin/schema-engine"
export PRISMA_QUERY_ENGINE_BINARY="${prisma-engines}/bin/query-engine"
export PRISMA_QUERY_ENGINE_LIBRARY="${prisma-engines}/lib/libquery_engine.node"
export PRISMA_INTROSPECTION_ENGINE_BINARY="${prisma-engines}/bin/introspection-engine"
export PRISMA_FMT_BINARY="${prisma-engines}/bin/prisma-fmt"
2023-06-17 02:17:51 +02:00
# Required to make gpg-agent work in cases like git commit
export GPG_TTY=(tty)
2023-06-17 02:17:51 +02:00
# 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")
set -x -U MANROFFOPT "-c"
2023-06-17 02:17:51 +02:00
# Always use the default keybindings in fish
fish_default_key_bindings
2023-06-17 02:17:51 +02:00
# Always use kitty ssh since it's our default terminal
if string match -qe -- "/dev/pts/" (tty)
alias ssh="kitty +kitten ssh"
end
'';
2023-06-17 02:17:51 +02:00
functions = {
wav2flac = /* fish */ ''
set ORIGINAL_SIZE (du -hs | cut -f1)
2023-06-17 02:17:51 +02:00
fd -e wav -x ffmpeg -i "{}" -loglevel quiet -stats "{.}.flac"
fd -e wav -X trash
2023-06-17 02:17:51 +02:00
set NEW_SIZE (du -hs | cut -f1)
2023-06-17 02:17:51 +02:00
echo "Done. Reduced file size from $ORIGINAL_SIZE to $NEW_SIZE"
'';
2023-06-17 02:17:51 +02:00
opus = /* fish */ ''
set ORIGINAL_SIZE (du -hs | cut -f1)
2023-06-17 02:17:51 +02:00
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
2023-06-17 02:17:51 +02:00
set NEW_SIZE (du -hs | cut -f1)
echo "Done. Reduced file size from $ORIGINAL_SIZE to $NEW_SIZE"
'';
};
};
2023-06-17 02:17:51 +02:00
}