command-not-found: Fix nix-env invocation

This commit is contained in:
Eelco Dolstra 2015-09-02 19:48:52 +02:00
parent 190a49e046
commit c090efb9d8
2 changed files with 5 additions and 5 deletions

View File

@ -57,9 +57,9 @@ in
if [ $? = 126 ]; then if [ $? = 126 ]; then
"$@" "$@"
fi fi
else else
# Indicate than there was an error so ZSH falls back to its default handler # Indicate than there was an error so ZSH falls back to its default handler
return 127 return 127
fi fi
} }
''; '';

View File

@ -30,11 +30,11 @@ The program $program is currently not installed. It is provided by
the package $package, which I will now install for you. the package $package, which I will now install for you.
EOF EOF
; ;
exit 126 if system("nix-env", "-iA", $package) == 0; exit 126 if system("nix-env", "-iA", "nixos.$package") == 0;
} else { } else {
print STDERR <<EOF; print STDERR <<EOF;
The program $program is currently not installed. You can install it by typing: The program $program is currently not installed. You can install it by typing:
nix-env -iA $package nix-env -iA nixos.$package
EOF EOF
} }
} else { } else {
@ -42,7 +42,7 @@ EOF
The program $program is currently not installed. It is provided by The program $program is currently not installed. It is provided by
several packages. You can install it by typing one of the following: several packages. You can install it by typing one of the following:
EOF EOF
print STDERR " nix-env -iA $_->{package}\n" foreach @$res; print STDERR " nix-env -iA nixos.$_->{package}\n" foreach @$res;
} }
exit 127; exit 127;