git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #108184 from lovesegfault/command-not-found-nix-shell

nixos/command-not-found: don't suggest nix-env

commit71e24364c9773d2d4058ad3b488d618603b80023 authorFlorian Klink <flokli@flokli.de> dateSat 2 Jan 2021, 12:04 (6 years ago) parentda3ee10e4cd9a8
1 file changed+8−7
nixos/modules/programs/command-not-found/command-not-found.pl+8−7
nixos/modules/programs/command-not-found/command-not-found.pl+8−7
@@ -27,8 +27,8 @@ if (!defined $res || scalar @$res == 0) {
2727 my $package = @$res[0]->{package};
2828 if ($ENV{"NIX_AUTO_INSTALL"} // "") {
2929 print STDERR <<EOF;
30−The program ‘$program’ is currently not installed. It is provided by
31−the package ‘$package’, which I will now install for you.
30+The program '$program' is currently not installed. It is provided by
31+the package '$package', which I will now install for you.
3232EOF
3333 ;
3434 exit 126 if system("nix-env", "-iA", "nixos.$package") == 0;
@@ -36,16 +36,17 @@ EOF
3636 exec("nix-shell", "-p", $package, "--run", shell_quote("exec", @ARGV));
3737 } else {
3838 print STDERR <<EOF;
39−The program ‘$program’ is currently not installed. You can install it by typing:
40− nix-env -iA nixos.$package
39+The program '$program' is not in your PATH. You can make it available in a
40+ephemeral shell by typing:
41+ nix-shell -p $package
4142EOF
4243 }
4344} else {
4445 print STDERR <<EOF;
45−The program ‘$program’ is currently not installed. It is provided by
46−several packages. You can install it by typing one of the following:
46+The program '$program' is not in your PATH. It is provided by several packages.
47+You can make it available in a ephemeral shell by typing one of the following:
4748EOF
48− print STDERR " nix-env -iA nixos.$_->{package}\n" foreach @$res;
49+ print STDERR " nix-shell -p $_->{package}\n" foreach @$res;
4950}
5051
5152exit 127;