From 35cf83cb70b62eacc730a4839d0233f27cb512ed Mon Sep 17 00:00:00 2001 From: Anish Govind Date: Sat, 15 Aug 2026 19:35:46 -0700 Subject: [PATCH] added zsh configs and other configs --- home/default.nix | 1 + home/hypr/default.nix | 11 +- home/hypr/hyprland.nix | 9 +- home/hypr/waybar.nix | 230 +++++++++++++++++++++++++++++++++ home/zsh.nix | 207 +++++++++++++++++++++++++++++ modules/apps/browser.nix | 6 +- modules/apps/communication.nix | 3 +- modules/apps/dev.nix | 2 +- modules/apps/terminal.nix | 2 +- modules/core/system.nix | 2 +- 10 files changed, 458 insertions(+), 15 deletions(-) create mode 100644 home/hypr/waybar.nix create mode 100644 home/zsh.nix diff --git a/home/default.nix b/home/default.nix index b5079e1..58e27d2 100644 --- a/home/default.nix +++ b/home/default.nix @@ -5,6 +5,7 @@ ./hypr ./foot.nix ./brave.nix + ./zsh.nix ]; xdg.portal.config.common.default = "*"; diff --git a/home/hypr/default.nix b/home/hypr/default.nix index 5ce0f87..c8e6321 100644 --- a/home/hypr/default.nix +++ b/home/hypr/default.nix @@ -5,14 +5,23 @@ ./hyprland.nix ./hyprlock.nix ./hypridle.nix -# ../waybar + ./waybar.nix ]; home.packages = with pkgs; [ + # Utilities & Tools grim slurp wl-clipboard cliphist brightnessctl + + # Desktop Environment / Hyprland ecosystem + waybar + hyprpaper + swaynotificationcenter + rofi + wlogout + hyprpolkitagent ]; } diff --git a/home/hypr/hyprland.nix b/home/hypr/hyprland.nix index 632e8d9..616b2fe 100644 --- a/home/hypr/hyprland.nix +++ b/home/hypr/hyprland.nix @@ -180,10 +180,8 @@ in (mkLua ''function() hl.exec_cmd("waybar") hl.exec_cmd("hyprpaper") - hl.exec_cmd("swayidle -w") hl.exec_cmd("swaync") - hl.exec_cmd("/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1") - hl.exec_cmd("hyprlock") + hl.exec_cmd("${pkgs.hyprpolkitagent}/libexec/hyprpolkitagent") end'') ]; } @@ -227,7 +225,6 @@ in # Quick access applications { _args = [ (mkLua "mainMod .. \" + b\"") (mkLua "hl.dsp.exec_cmd(browser)") ]; } - { _args = [ (mkLua "mainMod .. \" + t\"") (mkLua "hl.dsp.exec_cmd(\"thunderbird\")") ]; } # Scratch workspace { _args = [ (mkLua "mainMod .. \" + RETURN\"") (mkLua "hl.dsp.workspace.toggle_special(\"scratch\")") ]; } @@ -356,8 +353,8 @@ in workspace = "special:messaging"; } { - name = "webcord-messaging"; - match = { class = "WebCord"; }; + name = "vesktop-messaging"; + match = { class = "vesktop"; }; workspace = "special:messaging"; } { diff --git a/home/hypr/waybar.nix b/home/hypr/waybar.nix new file mode 100644 index 0000000..c3a8e20 --- /dev/null +++ b/home/hypr/waybar.nix @@ -0,0 +1,230 @@ +{ pkgs, ... }: + +{ + programs.waybar = { + enable = true; + settings = { + mainBar = { + layer = "top"; + modules-left = [ "custom/symbol" "cpu" "memory" "keyboard-state" "tray" ]; + modules-center = [ "hyprland/workspaces" ]; + modules-right = [ "idle_inhibitor" "backlight" "pulseaudio" "group/networks" "battery" "clock" ]; + + pulseaudio = { + tooltip = false; + scroll-step = 5; + format = "{icon} {volume}%"; + format-muted = "󰝟 {volume}%"; + on-click-right = "pactl set-sink-mute @DEFAULT_SINK@ toggle"; + on-click = "pavucontrol"; + format-icons = { + default = [ + "" + "" + "" + ]; + }; + }; + + idle_inhibitor = { + format = "{icon}"; + format-icons = { + activated = ""; + deactivated = ""; + }; + }; + + "custom/network-symbol" = { + format = "  "; + tooltip = false; + on-click = "nm-connection-editor"; + }; + + "group/networks" = { + orientation = "inherit"; + drawer = { + children-class = "drawer-network"; + }; + modules = [ + "custom/network-symbol" + "network" + ]; + }; + + network = { + tooltip = false; + format-wifi = "{ipaddr} ({essid})"; + format-ethernet = "{ipaddr}"; + }; + + keyboard-state = { + numlock = true; + capslock = true; + format = { + numlock = "N {icon}"; + capslock = "C {icon}"; + }; + format-icons = { + locked = " "; + unlocked = " "; + }; + }; + + backlight = { + tooltip = false; + format = " {}%"; + interval = 1; + on-scroll-up = "brightnessctl set +5%"; + on-scroll-down = "brightnessctl set 5%-"; + }; + + battery = { + states = { + good = 95; + warning = 30; + critical = 20; + }; + format = "{icon} {capacity}%"; + format-charging = " {capacity}%"; + format-plugged = " {capacity}%"; + format-alt = "{time} {icon}"; + format-icons = [ + "" + "" + "" + "" + "" + ]; + }; + + tray = { + icon-size = 18; + spacing = 10; + }; + + clock = { + format = "{:%I:%M %p | %m/%d/%Y}"; + }; + + cpu = { + interval = 15; + format = " {}%"; + max-length = 10; + }; + + memory = { + interval = 30; + format = " {}%"; + max-length = 10; + }; + + "custom/symbol" = { + format = " 󰣇 "; + tooltip = false; + }; + + "group/workspaces" = { + orientation = "inherit"; + drawer = { + children-class = "drawer-workspace"; + }; + modules = [ + "custom/symbol" + "hyprland/workspaces" + ]; + }; + + "hyprland/workspaces" = { + disable-scroll = true; + active-only = true; + format = "{name} [ {windows} ]"; + window-rewrite-default = ""; + format-window-separator = " "; + window-rewrite = { + "class" = ""; + "class" = ""; + "class" = ""; + "class" = ""; + "class" = ""; + "class" = ""; + "class" = ""; + "class" = ""; + }; + }; + }; + }; + + style = '' + * { + font-family: "SF Pro Display", "Font Awesome 6 Free", "JetBrainsMono Nerd Font"; + font-size: 16px; + min-height: 10px; + color: #c0caf5; + background: transparent; + } + + window#waybar { + background: rgba(255, 255, 255, 0.2); + border-radius: 5px; + } + + #keyboard-state, + #pulseaudio, + #backlight, + #clock, + #memory, + #cpu, + #battery, + #custom-symbol, + #custom-network-symbol, + #privacy, + #tray, + #idle_inhibitor, + #workspaces button, + #workspaces button.active { + margin: 5px; + border-radius: 3px; + transition: none; + border-bottom: 3px solid #c0caf5; + } + + #keyboard-state:hover, + #pulseaudio:hover, + #backlight:hover, + #clock:hover, + #memory:hover, + #cpu:hover, + #custom-symbol:hover, + #custom-network-symbol:hover, + #privacy:hover, + #tray:hover, + #idle_inhibitor:hover, + #workspaces button:hover { + border-bottom: 3px solid #0dd2e7; + } + + #battery.charging, + #battery.plugged { + color: #c3e88d; + border-bottom: 3px solid #c3e88d; + } + + #battery.critical:not(.charging) { + color: #ff757f; + border-bottom: 3px solid #ff757f; + } + + #workspaces button.active, + #workspaces button.focus { + outline: none; + color: #0dd2e7; + text-shadow: none; + } + ''; + }; + + home.packages = with pkgs; [ + pavucontrol + networkmanagerapplet + ]; +} diff --git a/home/zsh.nix b/home/zsh.nix new file mode 100644 index 0000000..861a4be --- /dev/null +++ b/home/zsh.nix @@ -0,0 +1,207 @@ +{ config, pkgs, lib, ... }: + +{ + programs.bat = { + enable = true; + config = { + theme = "base16"; + }; + }; + + programs.lsd = { + enable = true; + enableZshIntegration = false; # We explicitly define custom aliases below + }; + + programs.fzf = { + enable = true; + enableZshIntegration = true; + defaultOptions = [ + "--color=dark" + "--color=fg:-1,bg:-1,hl:#c678dd,fg+:#ffffff,bg+:#4b5263,hl+:#d858fe" + "--color=info:#98c379,prompt:#61afef,pointer:#be5046,marker:#e5c07b,spinner:#61afef,header:#61afef" + ]; + }; + + programs.zoxide = { + enable = true; + enableZshIntegration = true; + options = [ "--cmd" "cd" ]; + }; + + programs.zsh = { + enable = true; + enableCompletion = true; + autosuggestion.enable = true; + syntaxHighlighting = { + enable = true; + highlighters = [ "main" "brackets" ]; + }; + + oh-my-zsh = { + enable = true; + plugins = [ + "git" + "tmux" + "battery" + "colored-man-pages" + "jsontools" + ]; + extraConfig = '' + COMPLETION_WAITING_DOTS="..." + ZVM_INIT_MODE="sourcing" + ''; + }; + + plugins = [ + { + name = "powerlevel10k"; + src = pkgs.zsh-powerlevel10k; + file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme"; + } + { + name = "fzf-tab"; + src = pkgs.zsh-fzf-tab; + file = "share/fzf-tab/fzf-tab.plugin.zsh"; + } + { + name = "zsh-interactive-cd"; + src = pkgs.fetchFromGitHub { + owner = "changyuheng"; + repo = "zsh-interactive-cd"; + rev = "e7d4802aa526ec069dafec6709549f4344ce9d4a"; + sha256 = "sha256-j23Ew18o7i/7dLlrTu0/54+6mbY8srsptfrDP/9BI/Q="; + }; + file = "zsh-interactive-cd.plugin.zsh"; + } + ]; + + sessionVariables = { + EDITOR = "nvim"; + BAT_THEME = "base16"; + ZSH_TMUX_FIXTERM = "true"; + GPG_TTY = "$(tty)"; + PNPM_HOME = "$HOME/.local/share/pnpm"; + }; + + shellAliases = { + vim = "nvim"; + cat = "bat --paging=never"; + ls = "lsd"; + l = "ls -al"; + clear = "clear -x"; + rm = "rm -I"; + zshconf = "$EDITOR $HOME/NixOS-Configs/home/zsh.nix"; + hyprconf = "$EDITOR $HOME/NixOS-Configs/home/hypr/hyprland.nix"; + setup = "source ./setup_env.sh"; + gpuenv = "__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia"; + digital = "$HOME/Tools/Digital/Digital.sh"; + }; + + initContent = lib.mkMerge [ + (lib.mkBefore '' + # Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. + if [[ -r "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh" ]]; then + source "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh" + fi + '') + (lib.mkAfter '' + # To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. + [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh + + # Path configuration + export PATH="$HOME/.local/bin:$HOME/bin:$HOME/.cargo/bin:$PNPM_HOME:$PATH" + + if [ -d "$HOME/Tools/xilinx/Vivado/2023.1/bin" ]; then + export PATH="$HOME/Tools/xilinx/Vivado/2023.1/bin:$PATH" + fi + + # Miniconda / conda profile hook if installed + if [ -f /opt/miniconda3/etc/profile.d/conda.sh ]; then + source /opt/miniconda3/etc/profile.d/conda.sh + fi + + # Environment modules support if available + if (( ''${+functions[module]} )) || [ -f /etc/modules/init/zsh ]; then + [ -f /etc/modules/init/zsh ] && source /etc/modules/init/zsh + module use --append "$HOME/.config/modulefiles" 2>/dev/null || true + fi + + # Auto-tmux configuration + use_auto_tmux () { + ! ([ -z "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ] || $(pgrep -x "i3" > /dev/null || pgrep -x "sway" > /dev/null || pgrep -x "Hyprland" > /dev/null)) + } + + if use_auto_tmux; then + export ZSH_TMUX_AUTOSTART=true + export ZSH_TMUX_AUTOCONNECT=false + export ZSH_TMUX_AUTOQUIT=true + else + export ZSH_TMUX_AUTOSTART=false + export ZSH_TMUX_AUTOCONNECT=false + export ZSH_TMUX_AUTOQUIT=false + fi + + if [[ -n "$TMUX" ]]; then + tmux-window-name() { + if [ -n "$TMUX_PLUGIN_MANAGER_PATH" ] && [ -f "$TMUX_PLUGIN_MANAGER_PATH/tmux-window-name/scripts/rename_session_windows.py" ]; then + ("$TMUX_PLUGIN_MANAGER_PATH/tmux-window-name/scripts/rename_session_windows.py" &) + fi + } + autoload -Uz add-zsh-hook + add-zsh-hook chpwd tmux-window-name + fi + + # Custom helper functions + perlmutter_pass () { + echo -n 'bw master password: ' + read -s MASTER_PASS + echo + echo -n 'Copying passkey...' + echo "$(echo "$MASTER_PASS" | bw get password iris.nersc.gov 2>/dev/null)$(echo "$MASTER_PASS" | bw get totp iris.nersc.gov 2>/dev/null)" | wl-copy + echo 'Done.' + } + + compiler_explorer () { + docker run -d -p 10240:10240 --name compiler-explorer madduci/docker-compiler-explorer + } + + airplay_server () { + uxplay -p 10000 -nh -n "$(hostname)" -restrict -allow 88:66:5A:76:32:F5 -allow C4:AC:AA:76:B7:80 + } + + zathura_md () { + cat "$1" | pandoc -f markdown -t pdf | zathura - + } + + fooocus () { + if [ -f "$HOME/Tools/Fooocus/entry_with_update.py" ]; then + "$HOME/.conda/envs/fooocus/bin/python" "$HOME/Tools/Fooocus/entry_with_update.py" + else + echo "Fooocus not found at $HOME/Tools/Fooocus" + fi + } + + # Per-host / system local overrides fallback + if [ -f "$HOME/.config/zsh/$(hostname)/env.sh" ]; then + source "$HOME/.config/zsh/$(hostname)/env.sh" + elif [ -f "$HOME/.zshrc.local" ]; then + source "$HOME/.zshrc.local" + fi + + # Fetch / Banner on interactive terminal start + if [[ -o interactive ]] && [ -z "$TMUX" ] && command -v pfetch >/dev/null 2>&1; then + pfetch + fi + '') + ]; + }; + + home.packages = with pkgs; [ + pfetch-rs + bitwarden-cli + pandoc + zathura + tmux + ]; +} diff --git a/modules/apps/browser.nix b/modules/apps/browser.nix index 2e4d663..876d644 100644 --- a/modules/apps/browser.nix +++ b/modules/apps/browser.nix @@ -1,7 +1,5 @@ -{ pkgs, ... }: +{ ... }: { - environment.systemPackages = with pkgs; [ - brave - ]; + # Browser is configured and managed via Home Manager (home/brave.nix) } diff --git a/modules/apps/communication.nix b/modules/apps/communication.nix index 4cb80cb..2e1a5a0 100644 --- a/modules/apps/communication.nix +++ b/modules/apps/communication.nix @@ -2,6 +2,7 @@ { environment.systemPackages = with pkgs; [ - discord + vesktop + signal-desktop ]; } diff --git a/modules/apps/dev.nix b/modules/apps/dev.nix index 421186c..8e838d7 100644 --- a/modules/apps/dev.nix +++ b/modules/apps/dev.nix @@ -3,9 +3,9 @@ { environment.systemPackages = with pkgs; [ neovim - git uv rustup + ghidra antigravity-cli pi-coding-agent ]; diff --git a/modules/apps/terminal.nix b/modules/apps/terminal.nix index 68f294d..64f812c 100644 --- a/modules/apps/terminal.nix +++ b/modules/apps/terminal.nix @@ -1,8 +1,8 @@ { pkgs, ... }: { + # Foot terminal is configured and managed via Home Manager (home/foot.nix) environment.systemPackages = with pkgs; [ - foot zoxide fzf ]; diff --git a/modules/core/system.nix b/modules/core/system.nix index 59e1949..1c5b3eb 100644 --- a/modules/core/system.nix +++ b/modules/core/system.nix @@ -22,12 +22,12 @@ git curl wget - vim btop gparted pciutils usbutils egl-wayland + pulseaudio # Provides `pactl` for audio volume control bindings ]; system.stateVersion = "26.05";