Enhance Justfile and zsh module: streamline switch commands, add nsp function

This commit is contained in:
2026-05-06 00:02:17 +02:00
parent 363545b49b
commit ca86c9fe74
3 changed files with 15 additions and 5 deletions
+4 -1
View File
@@ -23,10 +23,13 @@ format:
treefmt .
switch:
nh os switch --refresh
nh os switch
switch_update:
nh os switch --refresh --update
switch_update_commit:
nh os switch --refresh --update --commit-lock-file
help:
@just --list
+4
View File
@@ -40,6 +40,10 @@
nix_shell = {
symbol = "";
format = "[](fg:#7EBAE4)[$symbol $state](bg:#7EBAE4 fg:#061A40)[](fg:#7EBAE4) ";
impure_msg = "impure";
pure_msg = "pure";
unknown_msg = "unknown";
heuristic = true;
};
python = {
+7 -4
View File
@@ -24,8 +24,6 @@
];
shellAliases = {
adbauto = "adbauto_";
adbpair = "adbpair_";
cat = "bat";
};
@@ -57,7 +55,7 @@
nix-your-shell zsh | source /dev/stdin
fi
adbauto_() {
adbauto() {
local PORT=$(avahi-browse -rt _adb-tls-connect._tcp -p | grep '^=' | cut -d';' -f8,9 | head -n 1 | sed 's/;/ /' | awk '{print $2}')
local IP=$(avahi-browse -rt _adb-tls-connect._tcp -p | grep '^=' | cut -d';' -f8,9 | head -n 1 | sed 's/;/ /' | awk '{print $1}')
if [ -z "$PORT" ]; then
@@ -68,7 +66,7 @@
fi
}
adbpair_() {
adbpair() {
echo "Looking for Android pairing service..."
local SERVICE=$(avahi-browse -rt _adb-tls-pairing._tcp -p | grep '^=' | head -n 1)
if [ -z "$SERVICE" ]; then
@@ -81,6 +79,10 @@
adb pair "$IP:$PORT"
}
nsp() {
IN_NIX_SHELL="impure" nix shell $(echo "$@" | sed 's/\([^ ]*\)/nixpkgs#\1/g')
}
# Dank `sudo` OMZ plugin replacement
prepend-sudo() {
if [[ $BUFFER != su(do|)\ * ]]; then
@@ -88,6 +90,7 @@
CURSOR+=5
fi
}
zle -N prepend-sudo
bindkey "\e\e" prepend-sudo
'';