diff --git a/.config/nixos/core.nix b/.config/nixos/core.nix index 8adba03..f5897a5 100644 --- a/.config/nixos/core.nix +++ b/.config/nixos/core.nix @@ -1,8 +1,15 @@ { config, pkgs, ... }: { + # Nix settings nix = { package = pkgs.nixFlakes; + settings.auto-optimise-store = true; + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 7d"; + }; extraOptions = '' experimental-features = nix-command flakes ''; @@ -87,6 +94,7 @@ distrobox # Easily spin up VMs of other distos entr # Hooks for file changes expect # Provides `unbuffer` + ffmpeg git # Imagine not having this grc # Generic command output colorizer htop-vim # Process monitor, with vim bindings diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index 7c7df8a..72e46c8 100755 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -49,7 +49,7 @@ preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt. # The rice repo alias config='git --git-dir $HOME/repos/dotfiles/ --work-tree=$HOME' -alias sudo='sudo ' # Allow aliases to be passed to sudo +alias s='sudo ' # Allow aliases to be passed to sudo alias pypr='sh -c pypr' alias asciiquarium='asciiquarium -t' alias ll='ls -l' @@ -66,9 +66,6 @@ alias tor='torbrowser-launcher' alias emax="devour emacsclient -c -a 'emacs' 1>/dev/null" alias em="emacsclient -nw -a 'emacs -nw'" -# Print out all colors -alias colors='for i in {0..255}; do print -Pn "%K{$i} %k%F{$i}${(l:3::0:)i}%f " ${${(M)$((i%6)):#3}:+$"\n"}; done' - # Colorful output alias ls='LC_COLLATE=C ls --color=auto --group-directories-first -hN -A' alias grep='grep --color=auto' @@ -87,6 +84,12 @@ alias uptime='grc uptime' ## FUNCTIONS ## +function colors { + for i in {0..255}; do + print -Pn "%K{$i} %k%F{$i}${(l:3::0:)i}%f " ${${(M)$((i%6)):#3}:+$"\n"}; + done +} + function lfcd { tmp="$(mktemp)" command lf -last-dir-path="$tmp" "$@" @@ -101,6 +104,18 @@ function lfcd { fi } +function nix-clean { + nix-env --delete-generations old + nix-store --gc + nix-channel --update + nix-env -u --always + for link in /nix/var/nix/gcroots/auto/* + do + rm $(readlink "$link") + done + nix-collect-garbage -d +} + # This script was automatically generated by the broot program # More information can be found in https://github.com/Canop/broot # This function starts broot and executes the command @@ -131,6 +146,10 @@ function nix_shell_menu { " } +function nixstore () { + cd "$(dirname $(readlink -f $(which "$1")))" +} + # function man () { # emacsclient -nw --eval '(progn (man "'$1'"))' # } @@ -177,7 +196,7 @@ if [ ! -z "$(grep nixos /etc/os-release)" ]; then nix-shell "$@" fi } - alias nix-shell='nix-shell-name' + alias nix-shell=nix-shell-name else source ~/.config/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.plugin.zsh fi @@ -188,5 +207,8 @@ if [ -f ~/.config/zsh/.zshpersonalrc ]; then source ~/.config/zsh/.zshpersonalrc fi +accent_color="$(cat $HOME/.config/colors/accent)" +starship config format "'''[╭──\([\$username@\$hostname](bold $accent_color)\)-\[\$directory\](-\[\$git_branch\$git_metrics\$git_status\])(-\[\$nix_shell\])]($accent_color) \$cmd_duration +[╰─]($accent_color)[\$shell](bold $accent_color) '''" eval "$(starship init zsh)"