Recent nix stuff

This commit is contained in:
agryphus 2024-01-08 23:02:22 -05:00
parent 999d1693d1
commit 99d4a8591f
2 changed files with 35 additions and 5 deletions

View file

@ -1,8 +1,15 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
# Nix settings
nix = { nix = {
package = pkgs.nixFlakes; package = pkgs.nixFlakes;
settings.auto-optimise-store = true;
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 7d";
};
extraOptions = '' extraOptions = ''
experimental-features = nix-command flakes experimental-features = nix-command flakes
''; '';
@ -87,6 +94,7 @@
distrobox # Easily spin up VMs of other distos distrobox # Easily spin up VMs of other distos
entr # Hooks for file changes entr # Hooks for file changes
expect # Provides `unbuffer` expect # Provides `unbuffer`
ffmpeg
git # Imagine not having this git # Imagine not having this
grc # Generic command output colorizer grc # Generic command output colorizer
htop-vim # Process monitor, with vim bindings htop-vim # Process monitor, with vim bindings

View file

@ -49,7 +49,7 @@ preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt.
# The rice repo # The rice repo
alias config='git --git-dir $HOME/repos/dotfiles/ --work-tree=$HOME' 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 pypr='sh -c pypr'
alias asciiquarium='asciiquarium -t' alias asciiquarium='asciiquarium -t'
alias ll='ls -l' alias ll='ls -l'
@ -66,9 +66,6 @@ alias tor='torbrowser-launcher'
alias emax="devour emacsclient -c -a 'emacs' 1>/dev/null" alias emax="devour emacsclient -c -a 'emacs' 1>/dev/null"
alias em="emacsclient -nw -a 'emacs -nw'" 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 # Colorful output
alias ls='LC_COLLATE=C ls --color=auto --group-directories-first -hN -A' alias ls='LC_COLLATE=C ls --color=auto --group-directories-first -hN -A'
alias grep='grep --color=auto' alias grep='grep --color=auto'
@ -87,6 +84,12 @@ alias uptime='grc uptime'
## FUNCTIONS ## ## 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 { function lfcd {
tmp="$(mktemp)" tmp="$(mktemp)"
command lf -last-dir-path="$tmp" "$@" command lf -last-dir-path="$tmp" "$@"
@ -101,6 +104,18 @@ function lfcd {
fi 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 # This script was automatically generated by the broot program
# More information can be found in https://github.com/Canop/broot # More information can be found in https://github.com/Canop/broot
# This function starts broot and executes the command # 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 () { # function man () {
# emacsclient -nw --eval '(progn (man "'$1'"))' # emacsclient -nw --eval '(progn (man "'$1'"))'
# } # }
@ -177,7 +196,7 @@ if [ ! -z "$(grep nixos /etc/os-release)" ]; then
nix-shell "$@" nix-shell "$@"
fi fi
} }
alias nix-shell='nix-shell-name' alias nix-shell=nix-shell-name
else else
source ~/.config/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.plugin.zsh source ~/.config/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.plugin.zsh
fi fi
@ -188,5 +207,8 @@ if [ -f ~/.config/zsh/.zshpersonalrc ]; then
source ~/.config/zsh/.zshpersonalrc source ~/.config/zsh/.zshpersonalrc
fi 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)" eval "$(starship init zsh)"