mirror of
https://github.com/moons-14/dotfiles.git
synced 2026-10-06 18:44:09 +09:00
nh
This commit is contained in:
@@ -5,4 +5,38 @@
|
|||||||
NH_FLAKE = "${config.home.homeDirectory}/dotfiles";
|
NH_FLAKE = "${config.home.homeDirectory}/dotfiles";
|
||||||
NH_SHOW_ACTIVATION_LOGS = "1";
|
NH_SHOW_ACTIVATION_LOGS = "1";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
programs.zsh.initContent = ''
|
||||||
|
export SUDO_PROMPT=$'\a[sudo] authenticate for %u: '
|
||||||
|
|
||||||
|
nh() {
|
||||||
|
local notify=false
|
||||||
|
local argument
|
||||||
|
|
||||||
|
case "$1:$2" in
|
||||||
|
os:switch | os:build) notify=true ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
for argument in "$@"; do
|
||||||
|
if [[ "$argument" == "--update" ]]; then
|
||||||
|
notify=true
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
command nh "$@"
|
||||||
|
local status=$?
|
||||||
|
|
||||||
|
if [[ "$notify" == true ]]; then
|
||||||
|
printf '\a'
|
||||||
|
if ((status == 0)); then
|
||||||
|
print -P "%F{green}nh completed%f"
|
||||||
|
else
|
||||||
|
print -P "%F{red}nh failed (exit $status)%f"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
return "$status"
|
||||||
|
}
|
||||||
|
'';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user