diff --git a/home/config/fonts/NerdFonts/SymbolsNerdFont-Regular.ttf b/home/config/fonts/NerdFonts/SymbolsNerdFont-Regular.ttf index c9263cc..4ab98de 100644 Binary files a/home/config/fonts/NerdFonts/SymbolsNerdFont-Regular.ttf and b/home/config/fonts/NerdFonts/SymbolsNerdFont-Regular.ttf differ diff --git a/home/config/fonts/NerdFonts/SymbolsNerdFontMono-Regular.ttf b/home/config/fonts/NerdFonts/SymbolsNerdFontMono-Regular.ttf index 534d52a..fbd5e15 100644 Binary files a/home/config/fonts/NerdFonts/SymbolsNerdFontMono-Regular.ttf and b/home/config/fonts/NerdFonts/SymbolsNerdFontMono-Regular.ttf differ diff --git a/home/config/fonts/default.nix b/home/config/fonts/default.nix index 5800ab5..df8abd9 100644 --- a/home/config/fonts/default.nix +++ b/home/config/fonts/default.nix @@ -22,7 +22,7 @@ let nerdfonts = pkgs.stdenvNoCC.mkDerivation { pname = "nerdfonts"; - version = "3.2.1"; + version = "3.3.0"; src = ./NerdFonts; diff --git a/home/config/nvim/nifoc/repl.fnl b/home/config/nvim/nifoc/repl.fnl index ed7f1d4..18bf1d9 100644 --- a/home/config/nvim/nifoc/repl.fnl +++ b/home/config/nvim/nifoc/repl.fnl @@ -22,6 +22,7 @@ (local nix #[(exe :nix) :repl]) (local ruby #[(exe :irb)]) (local typescript #[(exe :node)]) + (local zsh #[(exe :zsh)]) ;; Map filetype to REPL (local repl-map {: elixir : erlang @@ -31,10 +32,11 @@ : javascript : nix : ruby - : typescript}) + : typescript + : zsh}) (fn mod.open-shell [] - (let [shell (. repl-map :fish)] + (let [shell (. repl-map :zsh)] (open-split shell))) (fn mod.open-repl [] diff --git a/home/config/wezterm/config.fnl b/home/config/wezterm/config.fnl index 423d08b..50e4a9d 100644 --- a/home/config/wezterm/config.fnl +++ b/home/config/wezterm/config.fnl @@ -11,6 +11,7 @@ ; Icons :elixir "#A074C4" :et "#1C3062" + :nvim "#019833" :nix "#7EBAE4" :reddit "#FA4400" :ssh "#F4C82D"} @@ -24,48 +25,63 @@ (let [title tab.tab_title] (if (and title (> (length title) 0)) title tab.active_pane.title))) - (fn extract-tab-info [title] - (match title - (where t (t:find "^nvim%s")) - {:title (t:gsub "^nvim%s(.*)" "%1") :icon " " :color "#019833"} - (where t (t:find "^git%s")) - {:title (t:gsub "^git%s(.*)" "%1") :icon "󰊢 " :color "#F25029"} - (where t (t:find "^mix%s")) - {:title (t:gsub "^mix%s(.*)" "%1") :icon " " :color colors.elixir} - (where t (t:find "^iex%s")) {: title :icon " " :color colors.elixir} - (where t (t:find "^upa%s")) {: title :icon " " :color colors.nix} - (where t (t:find "^upp%s")) {: title :icon " " :color colors.nix} - (where t (t:find "^nrsw%s")) {: title :icon " " :color colors.nix} - (where t (t:find "^ngc%s")) {: title :icon " " :color colors.nix} - (where t (t:find "^nix%s")) {: title :icon " " :color colors.nix} - (where t (t:find "^nix-%w+%s")) {: title :icon " " :color colors.nix} - (where t (t:find "^colmena%s")) {: title :icon " " :color colors.nix} - (where t (t:find "^deploy%s")) {: title :icon " " :color colors.nix} - (where t (t:find "^ssh%s")) {: title :icon " " :color colors.ssh} - (where t (t:find "^scp%s")) {: title :icon " " :color colors.ssh} - (where t (t:find "^et%s")) {: title :icon " " :color colors.et} - (where t (t:find "^just%s")) {: title :icon " " :color "#C87D57"} - (where t (t:find :^ytdl)) {: title :icon " " :color "#FF0000"} - (where t (t:find :^instagram-)) {: title :icon " " :color "#FB2179"} - (where t (t:find "^gallery-dl%s")) - {:title (t:gsub "^gallery-dl%s(.*)" "%1") :icon " " :color "#009900"} - (where t (t:find "^bdfr%s")) - {:title (t:gsub "^bdfr%s(.*)" "%1") :icon " " :color colors.reddit} - (where t (t:find "^bdfr-%w+%s")) {: title - :icon " " - :color colors.reddit} - (where t (t:find "^rexit%s")) {: title :icon " " :color colors.reddit} - (where t (t:find :^redis-)) {: title :icon " " :color "#DC372C"} - (where t (t:find "^%[%w+%]%s")) {: title :icon " " :color colors.ssh} - (where t (t:find "^%w+@%w+:%s")) {: title :icon " " :color colors.ssh} - (where t (t:find "^%w+-dev")) {: title :icon " " :color "#0099CC"} - (where t (t:find "^%w+-dl%s")) {: title :icon " " :color "#22BC00"} - _ {: title :icon " " :color "#F8F8F2"})) + (fn extract-tab-info [title tab] + (let [current-pane tab.active_pane] + (match title + (where t (t:find "^nvim%s")) + {:title (t:gsub "^nvim%s(.*)" "%1") :icon " " :color colors.nvim} + (where t (t:find :^nvim$)) {: title :icon " " :color colors.nvim} + (where t (t:find "^git%s")) + {:title (t:gsub "^git%s(.*)" "%1") :icon "󰊢 " :color "#F25029"} + (where t (t:find "^mix%s")) + {:title (t:gsub "^mix%s(.*)" "%1") :icon " " :color colors.elixir} + (where t (t:find "^iex%s")) {: title :icon " " :color colors.elixir} + (where t (t:find "^upa%s")) {: title :icon " " :color colors.nix} + (where t (t:find "^upp%s")) {: title :icon " " :color colors.nix} + (where t (t:find "^nrsw%s")) {: title :icon " " :color colors.nix} + (where t (t:find "^ngc%s")) {: title :icon " " :color colors.nix} + (where t (t:find "^nix%s")) {: title :icon " " :color colors.nix} + (where t (t:find "^nix-%w+%s")) {: title + :icon " " + :color colors.nix} + (where t (t:find "^colmena%s")) {: title + :icon " " + :color colors.nix} + (where t (t:find "^deploy%s")) {: title :icon " " :color colors.nix} + (where t (t:find "^ssh%s")) {: title :icon " " :color colors.ssh} + (where t (t:find "^scp%s")) {: title :icon " " :color colors.ssh} + (where t (t:find "^et%s")) {: title :icon " " :color colors.et} + (where t (t:find "^just%s")) {: title :icon " " :color "#C87D57"} + (where t (t:find :^ytdl)) {: title :icon " " :color "#FF0000"} + (where t (t:find :^instagram-)) {: title :icon " " :color "#FB2179"} + (where t (t:find "^gallery-dl%s")) {:title (t:gsub "^gallery-dl%s(.*)" + "%1") + :icon " " + :color "#009900"} + (where t (t:find :^discord-)) {: title :icon " " :color "#5865F2"} + (where t (t:find "^bdfr%s")) + {:title (t:gsub "^bdfr%s(.*)" "%1") :icon " " :color colors.reddit} + (where t (t:find "^bdfr-%w+%s")) {: title + :icon " " + :color colors.reddit} + (where t (t:find "^rexit%s")) {: title + :icon " " + :color colors.reddit} + (where t (t:find :^redis-)) {: title :icon " " :color "#DC372C"} + (where t (t:find "^%[%w+%]%s")) {: title + :icon " " + :color colors.ssh} + (where t (t:find "^%w+@%w+:%s")) {: title + :icon " " + :color colors.ssh} + (where t (t:find "^%w+-dev")) {: title :icon " " :color "#0099CC"} + (where t (t:find "^%w+-dl%s")) {: title :icon " " :color "#22BC00"} + _ {: title :icon " " :color "#F8F8F2"}))) (wezterm.on :format-tab-title (fn [tab _tabs _panes _config _hover max-width] (let [raw-title (extract-tab-title tab) - tab-info (extract-tab-info raw-title) + tab-info (extract-tab-info raw-title tab) title (wezterm.truncate_right tab-info.title (- max-width 5))] (if tab.is_active @@ -142,7 +158,7 @@ (set overrides.freetype_load_target :Light) (window:set_config_overrides overrides)))))) ;; Configuration - {:default_prog [_G.shells.fish :--interactive] + {:default_prog [_G.shells.zsh :-i] ;; Appearance :color_scheme "Dracula (Official)" :window_decorations :INTEGRATED_BUTTONS|RESIZE @@ -220,8 +236,7 @@ ;; Launch Menu :launch_menu [{:label :Btop++ :args [_G.programs.btop]} {:label :bash :args [_G.shells.bash]} - {:label :fish :args [_G.shells.fish]} - {:label :nushell :args [_G.shells.nushell]}] + {:label :zsh :args [_G.shells.zsh]}] ;; Other :front_end :WebGpu :check_for_updates false}) diff --git a/home/hosts/Pallas.nix b/home/hosts/Pallas.nix index f10c213..7baeace 100644 --- a/home/hosts/Pallas.nix +++ b/home/hosts/Pallas.nix @@ -7,8 +7,7 @@ in imports = [ ../config/fonts - ../programs/fish.nix - ../programs/nushell.nix + ../programs/zsh ../programs/atuin.nix ../programs/direnv.nix ../programs/fzf.nix diff --git a/home/hosts/mediaserver.nix b/home/hosts/mediaserver.nix index 260fd1c..b4c102a 100644 --- a/home/hosts/mediaserver.nix +++ b/home/hosts/mediaserver.nix @@ -3,6 +3,7 @@ { imports = [ ../programs/fish.nix + ../programs/zsh ../programs/atuin.nix ../programs/starship.nix ../programs/direnv.nix diff --git a/home/programs/atuin.nix b/home/programs/atuin.nix index b41628f..58ff908 100644 --- a/home/programs/atuin.nix +++ b/home/programs/atuin.nix @@ -3,7 +3,7 @@ enable = true; enableBashIntegration = false; - enableZshIntegration = false; + enableZshIntegration = true; enableFishIntegration = true; settings = { @@ -25,6 +25,12 @@ }; }; + programs.zsh.history = { + save = 0; + size = 0; + share = false; + }; + programs.fish.shellInit = '' set -x fish_history "" ''; diff --git a/home/programs/fish.nix b/home/programs/fish.nix index 5054641..6e04d2c 100644 --- a/home/programs/fish.nix +++ b/home/programs/fish.nix @@ -95,7 +95,7 @@ in end pushd "$config_dir" - rm -rf result + rm -f result if test -z "$DIRENV_DIR" eval (direnv export fish 2>/dev/null) diff --git a/home/programs/starship.nix b/home/programs/starship.nix index 37c9e64..efcacc5 100644 --- a/home/programs/starship.nix +++ b/home/programs/starship.nix @@ -3,6 +3,7 @@ { programs.starship = { enable = true; + enableZshIntegration = true; enableFishIntegration = true; enableTransience = true; diff --git a/home/programs/wezterm.nix b/home/programs/wezterm.nix index e306923..5d040f5 100644 --- a/home/programs/wezterm.nix +++ b/home/programs/wezterm.nix @@ -1,26 +1,17 @@ -{ pkgs, config, ... }: +{ pkgs, ... }: let wezterm-pkg = pkgs.wezterm; - - wezterm-nushell = pkgs.writeShellScript "wezterm-nushell.sh" '' - source /etc/static/bashrc - source ${config.home.sessionVariablesPackage}/etc/profile.d/hm-session-vars.sh - - exec ${pkgs.nushell.outPath}/bin/nu - ''; in { programs.wezterm = { enable = true; - package = wezterm-pkg; extraConfig = /* lua */ '' _G.shells = { bash = '${pkgs.bash.outPath}/bin/bash', - fish = '${pkgs.fish.outPath}/bin/fish', - nushell = '${wezterm-nushell}', + zsh = '${pkgs.zsh.outPath}/bin/zsh', }; _G.programs = { diff --git a/home/programs/yt-dlp.nix b/home/programs/yt-dlp.nix index 3952b33..4a70877 100644 --- a/home/programs/yt-dlp.nix +++ b/home/programs/yt-dlp.nix @@ -1,42 +1,56 @@ -{ pkgs, config, lib, ... }: +{ pkgs, lib, ... }: { - programs.yt-dlp = { - enable = true; + programs = + let + ytdlPackage = pkgs.yt-dlp; + ytdlExe = lib.getExe ytdlPackage; + in + { + yt-dlp = { + enable = true; + package = ytdlPackage; - settings = { - format = "'bestvideo+bestaudio/best'"; - # Metadata - add-metadata = true; - embed-subs = true; - xattrs = true; - # Subtitles - write-sub = true; - sub-format = "best"; - sub-lang = "en,de"; - # Downloader - downloader = "aria2c"; - downloader-args = "aria2c:'--async-dns=false --max-download-limit=6M --min-split-size=1M --max-connection-per-server=4 --split=4'"; - # Other - no-overwrites = true; - no-call-home = true; + settings = { + format = "'bestvideo+bestaudio/best'"; + # Metadata + add-metadata = true; + embed-subs = true; + xattrs = true; + # Subtitles + write-sub = true; + sub-format = "best"; + sub-lang = "en,de"; + # Downloader + downloader = "aria2c"; + downloader-args = "aria2c:'--async-dns=false --max-download-limit=6M --min-split-size=1M --max-connection-per-server=4 --split=4'"; + # Other + no-overwrites = true; + no-call-home = true; + }; + }; + + zsh.shellAliases = { + ytdl = "${ytdlExe} --config-location \"$HOME/.config/yt-dlp/config\" --download-archive \"$HOME/.config/yt-dlp/archive\""; + ytdl_mp4 = "ytdl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]'"; + yti = "ytdl -F"; + }; + + 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 = '' + ${ytdlExe} --config-location "$HOME/.config/yt-dlp/config" --download-archive "$HOME/.config/yt-dlp/archive" $argv + ''; + }; }; - }; home.packages = with pkgs; [ aria2 rtmpdump ]; - - 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 = '' - ${lib.getExe config.programs.yt-dlp.package} --config-location "$HOME/.config/yt-dlp/config" --download-archive "$HOME/.config/yt-dlp/archive" $argv - ''; - }; } diff --git a/home/programs/zoxide.nix b/home/programs/zoxide.nix index c251187..9a0fda2 100644 --- a/home/programs/zoxide.nix +++ b/home/programs/zoxide.nix @@ -8,6 +8,11 @@ ji = "zi"; }; + programs.zsh.shellAliases = { + j = "z"; + ji = "zi"; + }; + programs.nushell.shellAliases = { j = "z"; ji = "zi"; diff --git a/home/programs/zsh/default.nix b/home/programs/zsh/default.nix new file mode 100644 index 0000000..7531bf1 --- /dev/null +++ b/home/programs/zsh/default.nix @@ -0,0 +1,144 @@ +{ pkgs, lib, config, ... }: + +let + inherit (pkgs) fetchFromGitHub; + inherit (pkgs.stdenv) isDarwin; + inherit (lib) optionals; + inherit (lib.attrsets) optionalAttrs; +in +{ + programs.zsh = { + enable = true; + + enableCompletion = true; + enableVteIntegration = !config.programs.wezterm.enable; + + autosuggestion = { + enable = true; + strategy = [ "completion" ]; + }; + + syntaxHighlighting = { + enable = true; + highlighters = [ "main" "brackets" ]; + }; + + plugins = [ + { + # https://github.com/dracula/zsh-syntax-highlighting + name = "dracula-zsh-syntax-highlighting"; + file = "zsh-syntax-highlighting.sh"; + src = fetchFromGitHub { + owner = "dracula"; + repo = "zsh-syntax-highlighting"; + rev = "09c89b657ad8a27ddfe1d6f2162e99e5cce0d5b3"; + hash = "sha256-JrSKx8qHGAF0DnSJiuKWvn6ItQHvWpJ5pKo4yNbrHno="; + }; + } + + { + # https://github.com/trystan2k/zsh-tab-title + name = "zsh-tab-title"; + file = "zsh-tab-title.plugin.zsh"; + src = fetchFromGitHub { + owner = "trystan2k"; + repo = "zsh-tab-title"; + rev = "9c36ac968fe675edcc181a41b0b8959024a8b6c1"; + hash = "sha256-ZEhbQ+yIfCz+vmua7XYBQ4kSVgwoNR8Y4zJyKNypsz0="; + }; + } + + { + # https://github.com/Freed-Wu/zsh-colorize-functions + name = "zsh-colorize-functions"; + file = "zsh-colorize-functions.plugin.zsh"; + src = fetchFromGitHub { + owner = "Freed-Wu"; + repo = "zsh-colorize-functions"; + rev = "46a299f8f8b1c71867679eaf4f67e30fd2746820"; + hash = "sha256-DvqhWgox8v3Km1Rzkg7tEDqJ2zF62K6ILAzlOhUbuCc="; + }; + } + + { + # https://github.com/Freed-Wu/zsh-help + name = "zsh-help"; + file = "zsh-help.plugin.zsh"; + src = fetchFromGitHub { + owner = "Freed-Wu"; + repo = "zsh-help"; + rev = "95cbc114078d8209730e38c72a6fa5859ca0773d"; + hash = "sha256-ij+ooXQxV3CmsCN/CrJMicTWvS+9GYHA/1Kuqh5zXIY="; + }; + } + ] ++ optionals isDarwin [ + { + # https://github.com/MichaelAquilina/zsh-auto-notify + name = "zsh-auto-notify"; + file = "auto-notify.plugin.zsh"; + src = fetchFromGitHub { + owner = "MichaelAquilina"; + repo = "zsh-auto-notify"; + rev = "27c07dddb42f05b199319a9b66473c8de7935856"; + hash = "sha256-ScBwky33leI8mFMpAz3Ng2Z0Gbou4EWMOAhkcMZAWIc="; + }; + } + ]; + + shellAliases = + let + ezaExe = lib.getExe pkgs.eza; + in + { + upa = "nix flake update ~/.config/nixpkgs -v && upn"; + ngc = "nix-collect-garbage -d && sudo nix-collect-garbage -d"; + nsr = "sudo nix-store --verify --check-contents --repair"; + + la = "${ezaExe} --long --all --group --header --group-directories-first --sort=type --icons"; + lg = "${ezaExe} --long --all --group --header --git"; + lt = "${ezaExe} --long --all --group --header --tree --level "; + } // optionalAttrs isDarwin { + tailscale = "/Applications/Tailscale.app/Contents/MacOS/Tailscale"; + }; + + initExtra = /* sh */ '' + # Keymaps + bindkey '^[[1;3C' forward-word # Alt+Right + bindkey '^[[1;3D' backward-word # Alt+Left + + # Plugins + ZSH_TAB_TITLE_ENABLE_FULL_COMMAND=true + ZSH_TAB_TITLE_DEFAULT_DISABLE_PREFIX=true + + AUTO_NOTIFY_THRESHOLD=10 + + # Path configuration + if [[ -d "$HOME/.bin" ]]; then + path=("$HOME/.bin" $path) + export PATH + fi + + () { + local user_functions="$HOME/.zsh/user_functions" + if [[ -d $user_functions ]]; then + typeset -TUg +x FPATH=$user_functions:$FPATH fpath + autoload ''${=$(cd "$user_functions" && echo *)} + fi + + local server_functions="$HOME/.zsh/server_functions" + if [[ -d $server_functions ]]; then + typeset -TUg +x FPATH=$server_functions:$FPATH fpath + autoload ''${=$(cd "$server_functions" && echo *)} + fi + } + ''; + }; + + home.file.".zsh/user_functions" = { + source = ./functions; + recursive = true; + }; + + # Plugin dependencies + programs.bat.enable = true; +} diff --git a/home/programs/zsh/functions/base64decode b/home/programs/zsh/functions/base64decode new file mode 100755 index 0000000..dd037f3 --- /dev/null +++ b/home/programs/zsh/functions/base64decode @@ -0,0 +1 @@ +echo -n "$1" | base64 --decode diff --git a/home/programs/zsh/functions/macos-app-id b/home/programs/zsh/functions/macos-app-id new file mode 100755 index 0000000..f582e6b --- /dev/null +++ b/home/programs/zsh/functions/macos-app-id @@ -0,0 +1 @@ +osascript -e "id of app \"$1\"" diff --git a/home/programs/zsh/functions/mediaservercmd b/home/programs/zsh/functions/mediaservercmd new file mode 100755 index 0000000..41da239 --- /dev/null +++ b/home/programs/zsh/functions/mediaservercmd @@ -0,0 +1 @@ +et -c "$*" mediaserver diff --git a/home/programs/zsh/functions/nrsw b/home/programs/zsh/functions/nrsw new file mode 100755 index 0000000..bd856c3 --- /dev/null +++ b/home/programs/zsh/functions/nrsw @@ -0,0 +1,32 @@ +os="$(uname)" +other_hostname="$1" + +case "$os" in + Darwin) + nix_hostname="$(scutil --get LocalHostName)" + config_dir="$HOME/.config/nixpkgs" + ;; + Linux) + nix_hostname="$(hostname -s)" + config_dir="/etc/nixos" + ;; + *) + echo "Unsupported OS" + exit 1 +esac + +pushd "$config_dir" +rm -f result + +if [ -z "$DIRENV_DIR" ]; then + eval "$(direnv export zsh 2>/dev/null)" +fi + +if [ -z "$other_hostname" ]; then + just deploy-local-machine "$nix_hostname" +else + just deploy-remote-machine "$other_hostname" +fi + +rm -f result +popd diff --git a/home/programs/zsh/functions/upn b/home/programs/zsh/functions/upn new file mode 100755 index 0000000..fd90625 --- /dev/null +++ b/home/programs/zsh/functions/upn @@ -0,0 +1,13 @@ +os="$(uname)" + +case "$os" in + Darwin) + $HOME/.config/nixpkgs/home/programs/nvim/update-plugins.sh + ;; + Linux) + /etc/nixos/home/programs/nvim/update-plugins.sh + ;; + *) + echo "Unsupported OS" + exit 1 +esac diff --git a/home/programs/zsh/functions/wezssh b/home/programs/zsh/functions/wezssh new file mode 100755 index 0000000..c216b76 --- /dev/null +++ b/home/programs/zsh/functions/wezssh @@ -0,0 +1 @@ +wezterm cli spawn --domain-name "SSH:$1" diff --git a/system/darwin/zsh.nix b/system/darwin/zsh.nix new file mode 100644 index 0000000..f5821ff --- /dev/null +++ b/system/darwin/zsh.nix @@ -0,0 +1,5 @@ +{ + programs.zsh = { + enable = true; + }; +} diff --git a/system/hosts/Pallas.nix b/system/hosts/Pallas.nix index 55c65e1..e7d17d9 100644 --- a/system/hosts/Pallas.nix +++ b/system/hosts/Pallas.nix @@ -11,7 +11,7 @@ in ../darwin/defaults.nix ../darwin/sudo.nix - ../darwin/fish.nix + ../darwin/zsh.nix ../darwin/attic.nix ../darwin/mas.nix diff --git a/system/hosts/mediaserver.nix b/system/hosts/mediaserver.nix index 60c13fa..8cb9e55 100644 --- a/system/hosts/mediaserver.nix +++ b/system/hosts/mediaserver.nix @@ -170,7 +170,7 @@ in home = "/home/daniel"; description = "Daniel"; extraGroups = [ "wheel" ]; - shell = pkgs.fish; + shell = pkgs.zsh; openssh.authorizedKeys.keys = [ ssh-keys.LAN ssh-keys.DanielsPhone ]; };