diff options
author | Nathan Zadoks <nathan@nathan7.eu> | 2015-12-27 16:36:17 +0100 |
---|---|---|
committer | Nathan Zadoks <nathan@nathan7.eu> | 2015-12-28 15:09:48 +0100 |
commit | 254eebd8a0782430dfb0b78bef3b657ad0caed8a (patch) | |
tree | 8dd45cea4af635bd6c15eb77eb6d013b39f35950 | |
parent | 1a07ecf9c5b832963842201f60727ca67df4f22c (diff) | |
download | nixpkgs-254eebd8a0782430dfb0b78bef3b657ad0caed8a.tar nixpkgs-254eebd8a0782430dfb0b78bef3b657ad0caed8a.tar.gz nixpkgs-254eebd8a0782430dfb0b78bef3b657ad0caed8a.tar.bz2 nixpkgs-254eebd8a0782430dfb0b78bef3b657ad0caed8a.tar.lz nixpkgs-254eebd8a0782430dfb0b78bef3b657ad0caed8a.tar.xz nixpkgs-254eebd8a0782430dfb0b78bef3b657ad0caed8a.tar.zst nixpkgs-254eebd8a0782430dfb0b78bef3b657ad0caed8a.zip |
command-not-found: add NIX_AUTO_RUN
-rw-r--r-- | nixos/modules/programs/command-not-found/command-not-found.nix | 2 | ||||
-rw-r--r-- | nixos/modules/programs/command-not-found/command-not-found.pl | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/nixos/modules/programs/command-not-found/command-not-found.nix b/nixos/modules/programs/command-not-found/command-not-found.nix index 9524d91ea3b..9d3f61f5ff9 100644 --- a/nixos/modules/programs/command-not-found/command-not-found.nix +++ b/nixos/modules/programs/command-not-found/command-not-found.nix @@ -16,7 +16,7 @@ let isExecutable = true; inherit (pkgs) 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 diff --git a/nixos/modules/programs/command-not-found/command-not-found.pl b/nixos/modules/programs/command-not-found/command-not-found.pl index b233d973a4a..5bdda26592e 100644 --- a/nixos/modules/programs/command-not-found/command-not-found.pl +++ b/nixos/modules/programs/command-not-found/command-not-found.pl @@ -3,6 +3,7 @@ use strict; use DBI; use DBD::SQLite; +use String::ShellQuote; use Config; my $program = $ARGV[0]; @@ -31,6 +32,8 @@ the package ‘$package’, which I will now install for you. EOF ; 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 { print STDERR <<EOF; The program ‘$program’ is currently not installed. You can install it by typing: |