WIP: Switch to NixOS #5
4 changed files with 49 additions and 7 deletions
|
@ -59,6 +59,9 @@ dotfiles:
|
||||||
f_pacman.conf:
|
f_pacman.conf:
|
||||||
dst: /etc/pacman.conf
|
dst: /etc/pacman.conf
|
||||||
src: etc/pacman.conf
|
src: etc/pacman.conf
|
||||||
|
f_pacman_zsh_hook:
|
||||||
|
dst: /etc/pacman.d/hooks/zsh.hook
|
||||||
|
src: etc/pacman.d/hooks/zsh.hook
|
||||||
f_sshd_config:
|
f_sshd_config:
|
||||||
dst: /etc/ssh/sshd_config
|
dst: /etc/ssh/sshd_config
|
||||||
src: etc/ssh/sshd_config
|
src: etc/ssh/sshd_config
|
||||||
|
@ -113,6 +116,7 @@ profiles:
|
||||||
Pacman:
|
Pacman:
|
||||||
dotfiles:
|
dotfiles:
|
||||||
- f_pacman.conf
|
- f_pacman.conf
|
||||||
|
- f_pacman_zsh_hook
|
||||||
- f_pacserve.service.conf
|
- f_pacserve.service.conf
|
||||||
Mirkwood:
|
Mirkwood:
|
||||||
dotfiles:
|
dotfiles:
|
||||||
|
|
|
@ -21,6 +21,34 @@ _fzf_compgen_path() {
|
||||||
_skim_compgen_path
|
_skim_compgen_path
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Command not found handler
|
||||||
|
# source https://wiki.archlinux.org/title/Zsh#pacman_-F_%22command_not_found%22_handler
|
||||||
|
function command_not_found_handler {
|
||||||
|
local purple='\e[1;35m' bright='\e[0;1m' green='\e[1;32m' reset='\e[0m'
|
||||||
|
printf 'zsh: command not found: %s\n' "$1"
|
||||||
|
local entries=(
|
||||||
|
${(f)"$(/usr/bin/pacman -F --machinereadable -- "/usr/bin/$1")"}
|
||||||
|
)
|
||||||
|
if (( ${#entries[@]} ))
|
||||||
|
then
|
||||||
|
printf "${bright}$1${reset} may be found in the following packages:\n"
|
||||||
|
local pkg
|
||||||
|
for entry in "${entries[@]}"
|
||||||
|
do
|
||||||
|
# (repo package version file)
|
||||||
|
local fields=(
|
||||||
|
${(0)entry}
|
||||||
|
)
|
||||||
|
if [[ "$pkg" != "${fields[2]}" ]]
|
||||||
|
then
|
||||||
|
printf "${purple}%s/${bright}%s ${green}%s${reset}\n" "${fields[1]}" "${fields[2]}" "${fields[3]}"
|
||||||
|
fi
|
||||||
|
printf ' /%s\n' "${fields[4]}"
|
||||||
|
pkg="${fields[2]}"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# search and install packages with skim
|
# search and install packages with skim
|
||||||
pi() {
|
pi() {
|
||||||
SELECTED_PKGS="$(paru -Slq | sk --header='Install packages' -m --preview 'paru -Si {1}')"
|
SELECTED_PKGS="$(paru -Slq | sk --header='Install packages' -m --preview 'paru -Si {1}')"
|
||||||
|
|
|
@ -1,6 +1,17 @@
|
||||||
# from https://wiki.archlinux.org/index.php/Zsh#On-demand_rehash
|
# from https://wiki.archlinux.org/index.php/Zsh#On-demand_rehash
|
||||||
catch_signal_usr1() {
|
|
||||||
trap catch_signal_usr1 USR1
|
zshcache_time="$(date +%s%N)"
|
||||||
rehash
|
|
||||||
|
autoload -Uz add-zsh-hook
|
||||||
|
|
||||||
|
rehash_precmd() {
|
||||||
|
if [[ -a /var/cache/zsh/pacman ]]; then
|
||||||
|
local paccache_time="$(date -r /var/cache/zsh/pacman +%s%N)"
|
||||||
|
if (( zshcache_time < paccache_time )); then
|
||||||
|
rehash
|
||||||
|
zshcache_time="$paccache_time"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
trap catch_signal_usr1 USR1
|
|
||||||
|
add-zsh-hook -Uz precmd rehash_precmd
|
||||||
|
|
|
@ -2,11 +2,10 @@
|
||||||
Operation = Install
|
Operation = Install
|
||||||
Operation = Upgrade
|
Operation = Upgrade
|
||||||
Operation = Remove
|
Operation = Remove
|
||||||
Type = Package
|
Type = Path
|
||||||
Target = usr/bin/*
|
Target = usr/bin/*
|
||||||
|
|
||||||
[Action]
|
[Action]
|
||||||
Depends = zsh
|
Depends = zsh
|
||||||
Depends = procps-ng
|
|
||||||
When = PostTransaction
|
When = PostTransaction
|
||||||
Exec = /usr/bin/pkill zsh --signal=USR1
|
Exec = /usr/bin/install -Dm644 /dev/null /var/cache/zsh/pacman
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue