From 44e1498e97155d698e07e6f175c2927834274609 Mon Sep 17 00:00:00 2001 From: pagedmov Date: Sat, 2 Nov 2024 05:49:22 -0400 Subject: [PATCH] fixed zshell.nix, decided to consolidate all declared home files into files.nix instead of having a dedicated directory --- hosts/desktop/home.nix | 42 ++++--- modules/home/default.nix | 2 +- modules/home/environment/starship.nix | 23 ++-- modules/home/environment/zshell.nix | 174 ++++---------------------- modules/home/files.nix | 120 ++++++++++++++++++ modules/home/files/default.nix | 7 -- modules/home/files/neofetch.nix | 114 ----------------- 7 files changed, 182 insertions(+), 300 deletions(-) create mode 100644 modules/home/files.nix delete mode 100644 modules/home/files/default.nix delete mode 100644 modules/home/files/neofetch.nix diff --git a/hosts/desktop/home.nix b/hosts/desktop/home.nix index 7c8fd22..1786879 100644 --- a/hosts/desktop/home.nix +++ b/hosts/desktop/home.nix @@ -27,32 +27,34 @@ in { ]; # My custom home-manager modules + + # modules/home/files homeFiles.enable = true; # modules/home/environment - hyprlandConfig.enable = true; - autojumpConfig.enable = true; + hyprlandConfig.enable = true; + autojumpConfig.enable = true; stylixHomeConfig.enable = true; - waybarConfig.enable = true; - gtkConfig.enable = true; - spicetifyConfig.enable = true; - starshipConfig.enable = true; + waybarConfig.enable = true; + gtkConfig.enable = true; + spicetifyConfig.enable = true; + starshipConfig.enable = true; # modules/home/programs - btopConfig.enable = true; - swayncConfig.enable = true; - userPkgs.enable = true; - cavaConfig.enable = true; - ezaConfig.enable = true; - firefoxConfig.enable = true; - fuzzelConfig.enable = true; - fzfConfig.enable = true; - gitConfig.enable = true; - kittyConfig.enable = true; - yaziConfig.enable = true; - zshConfig.enable = true; - passConfig.enable = true; - batConfig.enable = true; + btopConfig.enable = true; + swayncConfig.enable = true; + userPkgs.enable = true; + cavaConfig.enable = true; + ezaConfig.enable = true; + firefoxConfig.enable = true; + fuzzelConfig.enable = true; + fzfConfig.enable = true; + gitConfig.enable = true; + kittyConfig.enable = true; + yaziConfig.enable = true; + zshConfig.enable = true; + passConfig.enable = true; + batConfig.enable = true; # modules/home/scripts movScripts.enable = true; diff --git a/modules/home/default.nix b/modules/home/default.nix index 2943b06..005fd6c 100644 --- a/modules/home/default.nix +++ b/modules/home/default.nix @@ -12,7 +12,7 @@ ./programs ./environment ./scripts - ./files + ./files.nix ]; # ./files diff --git a/modules/home/environment/starship.nix b/modules/home/environment/starship.nix index a4d4e73..d5801cc 100644 --- a/modules/home/environment/starship.nix +++ b/modules/home/environment/starship.nix @@ -11,7 +11,7 @@ right_format = "($custom)"; format = lib.concatStrings [ - "($username)($ssh_symbol)($hostname)(bold white)($cmd_duration)($character)" + "($ssh_symbol)($username)($hostname)(bold white)($cmd_duration)($character)" "($git_branch)($git_status)($rust)($nix-shell)" "($directory)" "$line_break[οŒ“ > ](bold #89b4fa)" @@ -48,17 +48,18 @@ style = "bold purple"; }; - hostname = { - ssh_symbol = "🌐"; - ssh_only = false; - format = "[$ssh_symbol](bold blue)[$hostname](bold red)"; - }; + hostname = { + ssh_symbol = "🌐"; + ssh_only = false; + format = "[@](bold blue)[$hostname](bold red)"; + }; - custom.shellver = { - command = "zsh --version"; - when = ''test $SHELL = "/run/current-system/sw/bin/zsh"''; - symbol = "ξš‘"; - style = "bold magenta"; + custom.shellver = { + command = "zsh --version"; + when = ''test $SHELL = "/run/current-system/sw/bin/zsh"''; + symbol = "ξš‘"; + style = "bold magenta"; + }; }; }; }; diff --git a/modules/home/environment/zshell.nix b/modules/home/environment/zshell.nix index 84750d5..10f8620 100644 --- a/modules/home/environment/zshell.nix +++ b/modules/home/environment/zshell.nix @@ -9,128 +9,25 @@ }; programs.zsh = { enable = true; - highlight = "fg=#4C566A,underline"; - }; - shellAliases = { - grep = "grep --color=auto"; - yazi = "y"; - vi = "nvim"; - mv = "mv -v"; - cp = "cp -vr"; - gt = "gtrash"; - gtp = "playshellsound ${self}/assets/sound/rm.wav; gtrash put"; - sr = "source ~/.zshrc"; - ".." = "cd .."; - rm = "echo 'use \"gtp\" instead'"; - psg = "ps aux | grep -v grep | grep -i -e VSZ -e"; - mkdir = "mkdir -p"; - pk = "pkill -9 -f"; - svcu = "systemctl --user"; - svc = "sudo systemctl"; - viflake = "nvim flake.nix"; - - #git - "ga" = "playshellsound ${self}/assets/sound/gitadd.wav; git add"; - gco = "gitcheckout_sfx"; - gcomm = "gitcommit_sfx"; - gpush = "gitpush_sfx"; - gpull = "gitpull_sfx"; - greb = "gitrebase_sfx"; - }; - initExtra = '' - playshellsound() { - if [ $# -ne 1 ]; then - echo "Usage: playshellsound " - return 1 - fi - if ! scheck; then - return 0 - else - runbg aplay "$1" - fi - } - gitcheckout_sfx() { - if git checkout "$@"; then - playshellsound ${self}/assets/sound/gitcheckout.wav - return 0 - else - playshellsound ${self}/assets/sound/error.wav - return 1 - fi - } - gitrebase_sfx() { - if git rebase "$@"; then - playshellsound ${self}/assets/sound/gitrebase.wav - return 0 - else - playshellsound ${self}/assets/sound/error.wav - return 1 - fi - } - gitcommit_sfx() { - if git commit "$@"; then - playshellsound ${self}/assets/sound/gitcommit.wav - return 0 - else - playshellsound ${self}/assets/sound/error.wav - return 1 - fi - } - gitpush_sfx() { - if git push "$@"; then - playshellsound ${self}/assets/sound/gitpush.wav - return 0 - else - playshellsound ${self}/assets/sound/error.wav - return 1 - fi - } - gitpull_sfx() { - if git pull "$@"; then - playshellsound ${self}/assets/sound/gitpull.wav - return 0 - else - playshellsound ${self}/assets/sound/error.wav - return 1 - fi - } - unalias ls - ls() { - eza -1 --group-directories-first --icons "$@" - playshellsound ${self}/assets/sound/ls.wav - return 0 - } - - mkcd() { - mkdir -p "$1" && cd "$1" - } - - y() { - local tmp="$(mktemp -t "yazi-cwd.XXXXXX")" - yazi "$@" --cwd-file="$tmp" - if cwd="$(command cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then - builtin cd -- "$cwd" - fi - rm -f -- "$tmp" - } - - cd() { - local prev_sounds_enabled="$SOUNDS_ENABLED" - SOUNDS_ENABLED=0 - eza -1 --group-directories-first --icons "$@" - SOUNDS_ENABLED=$prev_sounds_enabled - builtin cd "$@" - playshellsound /nix/store/7a9w7np3qrvmzxjbs7xj05qq2yccgfsj-source/assets/sound/cd.wav - return 0 - } - if [ ! -e $HOME/.zsh_history ]; then - touch $HOME/.zsh_history - chmod 600 $HOME/.zsh_history - fi - setopt APPEND_HISTORY # Append history to the history file (don't overwrite) - setopt INC_APPEND_HISTORY # Append to the history file incrementally - setopt SHARE_HISTORY # Share history between all zsh sessions + shellAliases = { + grep = "grep --color=auto"; + yazi = "y"; + vi = "nvim"; + mv = "mv -v"; + cp = "cp -vr"; + gt = "gtrash"; + gtp = "playshellsound ${self}/assets/sound/rm.wav; gtrash put"; + sr = "source ~/.zshrc"; + ".." = "cd .."; + rm = "echo 'use \"gtp\" instead'"; + psg = "ps aux | grep -v grep | grep -i -e VSZ -e"; + mkdir = "mkdir -p"; + pk = "pkill -9 -f"; + svcu = "systemctl --user"; + svc = "sudo systemctl"; + viflake = "nvim flake.nix"; + }; sessionVariables = { SOUNDS_ENABLED = "1"; @@ -160,31 +57,6 @@ highlight = "fg=#4C566A,underline"; }; - shellAliases = { - grep = "grep --color=auto"; - yazi = "y"; - vi = "nvim"; - mv = "mv -v"; - cp = "cp -vr"; - gt = "gtrash"; - gtp = "playshellsound ${self}/assets/sound/rm.wav; gtrash put"; - sr = "source ~/.zshrc"; - ".." = "cd .."; - rm = "echo 'use \"gtp\" instead'"; - psg = "ps aux | grep -v grep | grep -i -e VSZ -e"; - mkdir = "mkdir -p"; - pk = "pkill -9 -f"; - svcu = "systemctl --user"; - svc = "sudo systemctl"; - viflake = "nvim flake.nix"; - - #git - "ga" = "playshellsound ${self}/assets/sound/gitadd.wav; git add"; - gcomm = "gitcommit_sfx"; - gpush = "gitpush_sfx"; - gpull = "gitpull_sfx"; - greb = "gitrebase_sfx"; - }; initExtra = '' playshellsound() { if [ $# -ne 1 ]; then @@ -197,6 +69,15 @@ runbg aplay "$1" fi } + gitcheckout_sfx() { + if git checkout "$@"; then + playshellsound ${self}/assets/sound/gitcheckout.wav + return 0 + else + playshellsound ${self}/assets/sound/error.wav + return 1 + fi + } gitrebase_sfx() { if git rebase "$@"; then playshellsound ${self}/assets/sound/gitrebase.wav @@ -270,7 +151,6 @@ setopt INC_APPEND_HISTORY # Append to the history file incrementally setopt SHARE_HISTORY # Share history between all zsh sessions - sessionVariables = { setopt CORRECT setopt NO_NOMATCH setopt LIST_PACKED diff --git a/modules/home/files.nix b/modules/home/files.nix new file mode 100644 index 0000000..7081622 --- /dev/null +++ b/modules/home/files.nix @@ -0,0 +1,120 @@ +{ lib, self, config, ... }: + +# This folder is for programs that do not have existing configuration modules in NixOS. +# Basically a to-do list for stuff I need to write my own modules for. +{ + options = { + homeFiles.enable = lib.mkEnableOption "enables declared custom files"; + }; + config = { + home.file = { + ".config/neofetch/config.conf".text = '' + username=$(whoami) + name_length=''${#username} + total_width=40 + side_length=$(( (total_width - name_length - 2) / 2 )) + + top_line=$(printf "─%.0s" $(seq 1 $side_length)) + top_line="$top_line $username " + top_line+=$(printf "─%.0s" $(seq 1 $side_length)) + + if (( (total_width - name_length) % 2 != 0 )); then + top_line+="─" + fi + + print_info() { + prin "β”Œ$top_line┐" + info " ​ ​ οŒ“ " distro + info " ​ ​ ξœ’ " kernel + info " ​ ​ ο’ˆ " wm + info " ​ ​ ο’‰ " shell + info " ​ ​ ξž• " term + info " ​ ​ ο€± " term_font + info " ​ ​ 󰏗 " packages + prin "β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜" + info cols + prin "\n \n \n \n \n ''${cl3}ο„‘ \n \n ''${cl5}ο„‘ \n \n ''${cl2}ο„‘ \n \n ''${cl6}ο„‘ \n \n ''${cl4}ο„‘ \n \n ''${cl1}ο„‘ \n \n ''${cl7}ο„‘ \n \n ''${cl0}ο„‘" + } + + kernel_shorthand="on" + distro_shorthand="on" + os_arch="off" + uptime_shorthand="on" + memory_percent="on" + package_managers="off" + shell_path="off" + shell_version="on" + speed_type="bios_limit" + speed_shorthand="on" + gtk_shorthand="on" + gtk2="on" + gtk3="on" + colors=(distro) + bold="on" + underline_enabled="on" + underline_char="-" + separator=" ο…Έ " + color_blocks="off" + block_range=(0 15) # Colorblocks + + # Colors for custom colorblocks + magenta="\033[1;35m" + green="\033[1;32m" + white="\033[1;37m" + blue="\033[1;34m" + red="\033[1;31m" + black="\033[1;40;30m" + yellow="\033[1;33m" + cyan="\033[1;36m" + reset="\033[0m" + bgyellow="\033[1;43;33m" + bgwhite="\033[1;47;37m" + cl0="''${reset}" + cl1="''${magenta}" + cl2="''${green}" + cl3="''${white}" + cl4="''${blue}" + cl5="''${red}" + cl6="''${yellow}" + cl7="''${cyan}" + cl8="''${black}" + cl9="''${bgyellow}" + cl10="''${bgwhite}" + + block_width=4 + block_height=1 + + bar_char_elapsed="-" + bar_char_total="=" + bar_border="on" + bar_length=15 + bar_color_elapsed="distro" + bar_color_total="distro" + + cpu_display="on" + memory_display="on" + battery_display="on" + disk_display="on" + + image_backend="kitty" + image_source="${self}/assets/images/nixos-logo.png" + image_size="250px" + image_loop="off" + + aascii_distro="auto" + ascii_colors=(distro) + ascii_bold="on" + + crop_mode="normal" + crop_offset="center" + + gap=2 + + yoffset=0 + xoffset=0 + + stdout="off" + ''; + }; + }; +} diff --git a/modules/home/files/default.nix b/modules/home/files/default.nix deleted file mode 100644 index 46c0ae7..0000000 --- a/modules/home/files/default.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ ... }: - -# This folder is for programs that do not have existing configuration modules in NixOS. -# Basically a to-do list for stuff I need to write my own modules for. -{ - imports = [ ./neofetch.nix ]; -} diff --git a/modules/home/files/neofetch.nix b/modules/home/files/neofetch.nix deleted file mode 100644 index 56ca33b..0000000 --- a/modules/home/files/neofetch.nix +++ /dev/null @@ -1,114 +0,0 @@ -{lib, config, self, ...}: { - options = { - homeFiles.enable = lib.mkEnableOption "enables declared custom files"; - }; - config = lib.mkIf config.homeFiles.enable { - home.file.".config/neofetch/config.conf".text = '' - username=$(whoami) - name_length=''${#username} - total_width=40 - side_length=$(( (total_width - name_length - 2) / 2 )) - - top_line=$(printf "─%.0s" $(seq 1 $side_length)) - top_line="$top_line $username " - top_line+=$(printf "─%.0s" $(seq 1 $side_length)) - - if (( (total_width - name_length) % 2 != 0 )); then - top_line+="─" - fi - - print_info() { - prin "β”Œ$top_line┐" - info " ​ ​ οŒ“ " distro - info " ​ ​ ξœ’ " kernel - info " ​ ​ ο’ˆ " wm - info " ​ ​ ο’‰ " shell - info " ​ ​ ξž• " term - info " ​ ​ ο€± " term_font - info " ​ ​ 󰏗 " packages - prin "β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜" - info cols - prin "\n \n \n \n \n ''${cl3}ο„‘ \n \n ''${cl5}ο„‘ \n \n ''${cl2}ο„‘ \n \n ''${cl6}ο„‘ \n \n ''${cl4}ο„‘ \n \n ''${cl1}ο„‘ \n \n ''${cl7}ο„‘ \n \n ''${cl0}ο„‘" - } - - kernel_shorthand="on" - distro_shorthand="on" - os_arch="off" - uptime_shorthand="on" - memory_percent="on" - package_managers="off" - shell_path="off" - shell_version="on" - speed_type="bios_limit" - speed_shorthand="on" - gtk_shorthand="on" - gtk2="on" - gtk3="on" - colors=(distro) - bold="on" - underline_enabled="on" - underline_char="-" - separator=" ο…Έ " - color_blocks="off" - block_range=(0 15) # Colorblocks - - # Colors for custom colorblocks - magenta="\033[1;35m" - green="\033[1;32m" - white="\033[1;37m" - blue="\033[1;34m" - red="\033[1;31m" - black="\033[1;40;30m" - yellow="\033[1;33m" - cyan="\033[1;36m" - reset="\033[0m" - bgyellow="\033[1;43;33m" - bgwhite="\033[1;47;37m" - cl0="''${reset}" - cl1="''${magenta}" - cl2="''${green}" - cl3="''${white}" - cl4="''${blue}" - cl5="''${red}" - cl6="''${yellow}" - cl7="''${cyan}" - cl8="''${black}" - cl9="''${bgyellow}" - cl10="''${bgwhite}" - - block_width=4 - block_height=1 - - bar_char_elapsed="-" - bar_char_total="=" - bar_border="on" - bar_length=15 - bar_color_elapsed="distro" - bar_color_total="distro" - - cpu_display="on" - memory_display="on" - battery_display="on" - disk_display="on" - - image_backend="kitty" - image_source="${self}/assets/images/nixos-logo.png" - image_size="250px" - image_loop="off" - - aascii_distro="auto" - ascii_colors=(distro) - ascii_bold="on" - - crop_mode="normal" - crop_offset="center" - - gap=2 - - yoffset=0 - xoffset=0 - - stdout="off" - ''; - }; -}