1
0
Fork 0

fish: Scope some aliases to their actual HM modules

This commit is contained in:
Daniel Kempkens 2023-05-04 11:14:12 +02:00
parent 63a6345cd8
commit 13de6156f4
Signed by: daniel
SSH key fingerprint: SHA256:Ks/MyhQYcPRQiwMKLAKquWCdCPe3JXlb1WttgnAoSeM
4 changed files with 31 additions and 13 deletions

View file

@ -85,7 +85,6 @@ in
shellAliases = { shellAliases = {
nrsw = "nixpkgs-switch"; nrsw = "nixpkgs-switch";
upa = "nix flake update ~/.config/nixpkgs -v && upn"; upa = "nix flake update ~/.config/nixpkgs -v && upn";
upn = "$HOME/.config/nixpkgs/home/programs/nvim/update-plugins.sh";
ngc = "nix-collect-garbage -d && sudo nix-collect-garbage -d"; ngc = "nix-collect-garbage -d && sudo nix-collect-garbage -d";
nsr = "sudo nix-store --verify --check-contents --repair"; nsr = "sudo nix-store --verify --check-contents --repair";
@ -94,9 +93,6 @@ in
la = "exa --long --all --group --header --group-directories-first --sort=type --icons"; la = "exa --long --all --group --header --group-directories-first --sort=type --icons";
lg = "exa --long --all --group --header --git"; lg = "exa --long --all --group --header --git";
lt = "exa --long --all --group --header --tree --level "; lt = "exa --long --all --group --header --tree --level ";
ytdl = "ytdl_with_options";
ytdl_mp4 = "ytdl_with_options -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]'";
yti = "ytdl_with_options -F";
mysqld-direnv-init = "mysql_install_db --user $USER --datadir=$PWD/.direnv/mysql/data --auth-root-authentication-method=normal"; mysqld-direnv-init = "mysql_install_db --user $USER --datadir=$PWD/.direnv/mysql/data --auth-root-authentication-method=normal";
mysqld-direnv = "mysqld --datadir=$PWD/.direnv/mysql/data --bind-address=127.0.0.1 --socket=$PWD/.direnv/mysql/mysqld.sock --gdb"; mysqld-direnv = "mysqld --datadir=$PWD/.direnv/mysql/data --bind-address=127.0.0.1 --socket=$PWD/.direnv/mysql/mysqld.sock --gdb";
@ -110,8 +106,18 @@ in
echo "$argv" | base64 --decode echo "$argv" | base64 --decode
''; '';
podman = '' upn = ''
fish -c "set -e SSH_AUTH_SOCK; ${config.home.profileDirectory}/bin/podman $argv" set -f os (uname)
switch $os
case Darwin
$HOME/.config/nixpkgs/home/programs/nvim/update-plugins.sh
case Linux
/etc/nixos/home/programs/nvim/update-plugins.sh
case '*'
echo "Unsupported OS"
exit 1
end
''; '';
upp = '' upp = ''
@ -131,10 +137,6 @@ in
set user_agent "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15" set user_agent "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15"
aria2c -U "$user_agent" --file-allocation none -x 2 $argv aria2c -U "$user_agent" --file-allocation none -x 2 $argv
''; '';
ytdl_with_options = ''
yt-dlp --config-location "$HOME/.config/yt-dlp/config" --download-archive "$HOME/.config/yt-dlp/archive" $argv
'';
}; };
shellInit = '' shellInit = ''

View file

@ -12,4 +12,8 @@
[engine] [engine]
helper_binaries_dir = ["${config.home.profileDirectory}/bin"] helper_binaries_dir = ["${config.home.profileDirectory}/bin"]
''; '';
programs.fish.functions.podman = ''
fish -c "set -e SSH_AUTH_SOCK; ${config.home.profileDirectory}/bin/podman $argv"
'';
} }

View file

@ -1,12 +1,12 @@
#!/usr/bin/env fish #!/usr/bin/env fish
set -g os (uname) set -f os (uname)
switch $os switch $os
case Darwin case Darwin
set -g config_dir "$HOME/.config/nixpkgs" set -f config_dir "$HOME/.config/nixpkgs"
case Linux case Linux
set -g config_dir /etc/nixos set -f config_dir /etc/nixos
case '*' case '*'
echo "Unsupported OS" echo "Unsupported OS"
exit 1 exit 1

View file

@ -11,4 +11,16 @@
source = ../config/yt-dlp; source = ../config/yt-dlp;
recursive = true; recursive = true;
}; };
programs.fish = {
shellAliases = {
ytdl = "ytdl_with_options";
ytdl_mp4 = "ytdl_with_options -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]'";
yti = "ytdl_with_options -F";
};
functions.ytdl_with_options = ''
yt-dlp --config-location "$HOME/.config/yt-dlp/config" --download-archive "$HOME/.config/yt-dlp/archive" $argv
'';
};
} }