diff --git a/home/programs/fish.nix b/home/programs/fish.nix index 1f46fb0..dba67bb 100644 --- a/home/programs/fish.nix +++ b/home/programs/fish.nix @@ -85,7 +85,6 @@ in shellAliases = { nrsw = "nixpkgs-switch"; 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"; 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"; lg = "exa --long --all --group --header --git"; 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 = "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 ''; - podman = '' - fish -c "set -e SSH_AUTH_SOCK; ${config.home.profileDirectory}/bin/podman $argv" + upn = '' + 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 = '' @@ -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" 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 = '' diff --git a/home/programs/podman.nix b/home/programs/podman.nix index a627582..651494d 100644 --- a/home/programs/podman.nix +++ b/home/programs/podman.nix @@ -12,4 +12,8 @@ [engine] helper_binaries_dir = ["${config.home.profileDirectory}/bin"] ''; + + programs.fish.functions.podman = '' + fish -c "set -e SSH_AUTH_SOCK; ${config.home.profileDirectory}/bin/podman $argv" + ''; } diff --git a/home/programs/scripts/nixpkgs-switch b/home/programs/scripts/nixpkgs-switch index 6db286d..46f61bd 100755 --- a/home/programs/scripts/nixpkgs-switch +++ b/home/programs/scripts/nixpkgs-switch @@ -1,12 +1,12 @@ #!/usr/bin/env fish -set -g os (uname) +set -f os (uname) switch $os case Darwin - set -g config_dir "$HOME/.config/nixpkgs" + set -f config_dir "$HOME/.config/nixpkgs" case Linux - set -g config_dir /etc/nixos + set -f config_dir /etc/nixos case '*' echo "Unsupported OS" exit 1 diff --git a/home/programs/yt-dlp.nix b/home/programs/yt-dlp.nix index 4e82792..2d86246 100644 --- a/home/programs/yt-dlp.nix +++ b/home/programs/yt-dlp.nix @@ -11,4 +11,16 @@ source = ../config/yt-dlp; 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 + ''; + }; }