fixed zshell.nix, decided to consolidate all declared home files into files.nix instead of having a dedicated directory

This commit is contained in:
pagedmov
2024-11-02 05:49:22 -04:00
parent acfea079b1
commit 44e1498e97
7 changed files with 182 additions and 300 deletions

View File

@@ -27,6 +27,8 @@ in {
]; ];
# My custom home-manager modules # My custom home-manager modules
# modules/home/files
homeFiles.enable = true; homeFiles.enable = true;
# modules/home/environment # modules/home/environment

View File

@@ -12,7 +12,7 @@
./programs ./programs
./environment ./environment
./scripts ./scripts
./files ./files.nix
]; ];
# ./files # ./files

View File

@@ -11,7 +11,7 @@
right_format = "($custom)"; right_format = "($custom)";
format = lib.concatStrings [ 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)" "($git_branch)($git_status)($rust)($nix-shell)"
"($directory)" "($directory)"
"$line_break[ > ](bold #89b4fa)" "$line_break[ > ](bold #89b4fa)"
@@ -51,7 +51,7 @@
hostname = { hostname = {
ssh_symbol = "🌐"; ssh_symbol = "🌐";
ssh_only = false; ssh_only = false;
format = "[$ssh_symbol](bold blue)[$hostname](bold red)"; format = "[@](bold blue)[$hostname](bold red)";
}; };
custom.shellver = { custom.shellver = {
@@ -62,4 +62,5 @@
}; };
}; };
}; };
};
} }

View File

@@ -9,8 +9,6 @@
}; };
programs.zsh = { programs.zsh = {
enable = true; enable = true;
highlight = "fg=#4C566A,underline";
};
shellAliases = { shellAliases = {
grep = "grep --color=auto"; grep = "grep --color=auto";
@@ -29,15 +27,36 @@
svcu = "systemctl --user"; svcu = "systemctl --user";
svc = "sudo systemctl"; svc = "sudo systemctl";
viflake = "nvim flake.nix"; 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";
}; };
sessionVariables = {
SOUNDS_ENABLED = "1";
EDITOR = "nvim";
SUDO_EDITOR = "nvim";
VISUAL = "nvim";
LANG = "en_US.UTF-8";
BROWSER = "firefox";
FLAKEPATH = "$HOME/.sysflake";
};
oh-my-zsh = {
enable = true;
plugins = ["git" "fzf"];
};
enableCompletion = true;
history = {
path = "$HOME/.zsh_history";
save = 10000;
size = 10000;
share = true;
};
autosuggestion = {
enable = true;
highlight = "fg=#4C566A,underline";
};
initExtra = '' initExtra = ''
playshellsound() { playshellsound() {
if [ $# -ne 1 ]; then if [ $# -ne 1 ]; then
@@ -132,145 +151,6 @@
setopt INC_APPEND_HISTORY # Append to the history file incrementally setopt INC_APPEND_HISTORY # Append to the history file incrementally
setopt SHARE_HISTORY # Share history between all zsh sessions setopt SHARE_HISTORY # Share history between all zsh sessions
sessionVariables = {
SOUNDS_ENABLED = "1";
EDITOR = "nvim";
SUDO_EDITOR = "nvim";
VISUAL = "nvim";
LANG = "en_US.UTF-8";
BROWSER = "firefox";
FLAKEPATH = "$HOME/.sysflake";
};
oh-my-zsh = {
enable = true;
plugins = ["git" "fzf"];
};
enableCompletion = true;
history = {
path = "$HOME/.zsh_history";
save = 10000;
size = 10000;
share = true;
};
autosuggestion = {
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";
gcomm = "gitcommit_sfx";
gpush = "gitpush_sfx";
gpull = "gitpull_sfx";
greb = "gitrebase_sfx";
};
initExtra = ''
playshellsound() {
if [ $# -ne 1 ]; then
echo "Usage: playshellsound <path/to/sound>"
return 1
fi
if ! scheck; then
return 0
else
runbg aplay "$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
sessionVariables = {
setopt CORRECT setopt CORRECT
setopt NO_NOMATCH setopt NO_NOMATCH
setopt LIST_PACKED setopt LIST_PACKED

120
modules/home/files.nix Normal file
View File

@@ -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"
'';
};
};
}

View File

@@ -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 ];
}

View File

@@ -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"
'';
};
}