mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-27 05:43:50 +03:00
command-not-found: add NIX_AUTO_RUN
This commit is contained in:
parent
1a07ecf9c5
commit
254eebd8a0
@ -16,7 +16,7 @@ let
|
|||||||
isExecutable = true;
|
isExecutable = true;
|
||||||
inherit (pkgs) perl;
|
inherit (pkgs) perl;
|
||||||
perlFlags = concatStrings (map (path: "-I ${path}/lib/perl5/site_perl ")
|
perlFlags = concatStrings (map (path: "-I ${path}/lib/perl5/site_perl ")
|
||||||
[ pkgs.perlPackages.DBI pkgs.perlPackages.DBDSQLite ]);
|
[ pkgs.perlPackages.DBI pkgs.perlPackages.DBDSQLite pkgs.perlPackages.StringShellQuote ]);
|
||||||
};
|
};
|
||||||
|
|
||||||
in
|
in
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
use strict;
|
use strict;
|
||||||
use DBI;
|
use DBI;
|
||||||
use DBD::SQLite;
|
use DBD::SQLite;
|
||||||
|
use String::ShellQuote;
|
||||||
use Config;
|
use Config;
|
||||||
|
|
||||||
my $program = $ARGV[0];
|
my $program = $ARGV[0];
|
||||||
@ -31,6 +32,8 @@ the package ‘$package’, which I will now install for you.
|
|||||||
EOF
|
EOF
|
||||||
;
|
;
|
||||||
exit 126 if system("nix-env", "-iA", "nixos.$package") == 0;
|
exit 126 if system("nix-env", "-iA", "nixos.$package") == 0;
|
||||||
|
} elsif ($ENV{"NIX_AUTO_RUN"} // "") {
|
||||||
|
exec("nix-shell", "-p", $package, "--run", shell_quote("exec", @ARGV));
|
||||||
} 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:
|
||||||
|
Loading…
Reference in New Issue
Block a user