diff options
author | Domen Kožar <domen@dev.si> | 2015-01-17 18:15:35 +0100 |
---|---|---|
committer | Domen Kožar <domen@dev.si> | 2015-01-17 18:15:35 +0100 |
commit | b92a62165daae1861efb4ee35917b8ba79e92491 (patch) | |
tree | 3d4361d6f8fbe70c259153f2fca7673836a1beee /nixos | |
parent | 46a938ad3aa1d8bf992d1b99352bc67929f1ddc1 (diff) | |
parent | 6cba6dc61bb0530ad03419364c19b299c6c9c6d4 (diff) | |
download | nixpkgs-b92a62165daae1861efb4ee35917b8ba79e92491.tar nixpkgs-b92a62165daae1861efb4ee35917b8ba79e92491.tar.gz nixpkgs-b92a62165daae1861efb4ee35917b8ba79e92491.tar.bz2 nixpkgs-b92a62165daae1861efb4ee35917b8ba79e92491.tar.lz nixpkgs-b92a62165daae1861efb4ee35917b8ba79e92491.tar.xz nixpkgs-b92a62165daae1861efb4ee35917b8ba79e92491.tar.zst nixpkgs-b92a62165daae1861efb4ee35917b8ba79e92491.zip |
Merge pull request #5726 from spwhitt/zsh-command-not-found
command-not-found: Add ZSH Support
Diffstat (limited to 'nixos')
-rwxr-xr-x | nixos/modules/module-list.nix | 2 | ||||
-rw-r--r-- | nixos/modules/programs/command-not-found/command-not-found.nix (renamed from nixos/modules/programs/bash/command-not-found.nix) | 20 | ||||
-rw-r--r-- | nixos/modules/programs/command-not-found/command-not-found.pl (renamed from nixos/modules/programs/bash/command-not-found.pl) | 0 |
3 files changed, 21 insertions, 1 deletions
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index bd9551fa199..9967020cf58 100755 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -54,8 +54,8 @@ ./misc/version.nix ./programs/atop.nix ./programs/bash/bash.nix - ./programs/bash/command-not-found.nix ./programs/blcr.nix + ./programs/command-not-found/command-not-found.nix ./programs/dconf.nix ./programs/environment.nix ./programs/info.nix diff --git a/nixos/modules/programs/bash/command-not-found.nix b/nixos/modules/programs/command-not-found/command-not-found.nix index 8c86d48b080..bead2dcdcf9 100644 --- a/nixos/modules/programs/bash/command-not-found.nix +++ b/nixos/modules/programs/command-not-found/command-not-found.nix @@ -44,6 +44,26 @@ in } ''; + programs.zsh.interactiveShellInit = + '' + # This function is called whenever a command is not found. + command_not_found_handler() { + local p=/run/current-system/sw/bin/command-not-found + if [ -x $p -a -f /nix/var/nix/profiles/per-user/root/channels/nixos/programs.sqlite ]; then + # Run the helper program. + $p "$1" + + # Retry the command if we just installed it. + if [ $? = 126 ]; then + "$@" + fi + else + # Indicate than there was an error so ZSH falls back to its default handler + return 127 + fi + } + ''; + environment.systemPackages = [ commandNotFound ]; # TODO: tab completion for uninstalled commands! :-) diff --git a/nixos/modules/programs/bash/command-not-found.pl b/nixos/modules/programs/command-not-found/command-not-found.pl index 916649059d3..916649059d3 100644 --- a/nixos/modules/programs/bash/command-not-found.pl +++ b/nixos/modules/programs/command-not-found/command-not-found.pl |