tidier nix thingies
This commit is contained in:
parent
a3cf550f0b
commit
07b9e2f950
|
@ -12,7 +12,7 @@
|
||||||
cd = "z";
|
cd = "z";
|
||||||
};
|
};
|
||||||
envExtra = ''
|
envExtra = ''
|
||||||
PROMPT=$'%B%n%b@%B%m%b: %~ %F{red}''${vcs_info_msg_0_}%f\nλ '
|
PROMPT=$'%B%n%b@%B%m%b: %~\nλ '
|
||||||
KEYTIMEOUT=1
|
KEYTIMEOUT=1
|
||||||
MODE_INDICATOR_VICMD='%K{10}%F{8}%B NORMAL %k%f%b'
|
MODE_INDICATOR_VICMD='%K{10}%F{8}%B NORMAL %k%f%b'
|
||||||
MODE_INDICATOR_REPLACE='%K{9}%F{8}%B REPLACE %k%f%b'
|
MODE_INDICATOR_REPLACE='%K{9}%F{8}%B REPLACE %k%f%b'
|
||||||
|
@ -39,36 +39,23 @@
|
||||||
setopt nomenucomplete
|
setopt nomenucomplete
|
||||||
setopt TRANSIENT_RPROMPT
|
setopt TRANSIENT_RPROMPT
|
||||||
|
|
||||||
run() {
|
nix-subcommand() {
|
||||||
pkg="$1"
|
cmd="$1"
|
||||||
[ "$pkg" = "''${pkg##*#}" ] && pkg="nixpkgs#$pkg"
|
|
||||||
export NIXPKGS_ALLOW_UNFREE=1 NIXPKGS_ALLOW_BROKEN=1
|
|
||||||
shift
|
shift
|
||||||
nix run --impure "$pkg" -- "$@"
|
pkgs=()
|
||||||
}
|
for pkg in "$@"; do
|
||||||
|
|
||||||
shell() {
|
|
||||||
i="$#"
|
|
||||||
while [ "$i" -gt 0 ]; do
|
|
||||||
pkg="$1"
|
|
||||||
[ "$pkg" = "''${pkg##*#}" ] && pkg="nixpkgs#$pkg"
|
|
||||||
shift
|
shift
|
||||||
set -- "$@" "$pkg"
|
[ "$pkg" = -- ] && break
|
||||||
: $(( i -= 1 ))
|
[ "$pkg" = "''${pkg##*#}" ] && pkg="nixpkgs#$pkg"
|
||||||
|
pkgs+="$pkg"
|
||||||
done
|
done
|
||||||
export NIXPKGS_ALLOW_UNFREE=1 NIXPKGS_ALLOW_BROKEN=1
|
export NIXPKGS_ALLOW_UNFREE=1 NIXPKGS_ALLOW_BROKEN=1
|
||||||
nix shell --impure "$@"
|
nix "$cmd" --impure "''${pkgs[@]}" -- "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
autoload -Uz add-zsh-hook vcs_info
|
shell() { nix-subcommand "shell" "$@" }
|
||||||
setopt prompt_subst
|
run() { nix-subcommand "run" "$@" }
|
||||||
add-zsh-hook precmd vcs_info
|
build() { nix-subcommand "build" "$@" }
|
||||||
|
|
||||||
zstyle ':vcs_info:*' check-for-changes true
|
|
||||||
zstyle ':vcs_info:*' unstagedstr '*'
|
|
||||||
zstyle ':vcs_info:*' stagedstr '+'
|
|
||||||
zstyle ':vcs_info:git:*' formats '(%b%u%c)'
|
|
||||||
zstyle ':vcs_info:git:*' actionformats '(%b|%a%u%c)'
|
|
||||||
'';
|
'';
|
||||||
plugins = [
|
plugins = [
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user