浏览代码

command-not-found: add support for NixOS (#7701)

SomeDer 5 年之前
父节点
当前提交
d79415b17d
共有 2 个文件被更改,包括 8 次插入0 次删除
  1. 1 0
      plugins/command-not-found/README.md
  2. 7 0
      plugins/command-not-found/command-not-found.plugin.zsh

+ 1 - 0
plugins/command-not-found/README.md

@@ -27,5 +27,6 @@ It works out of the box with the command-not-found packages for:
 - [Arch Linux](https://wiki.archlinux.org/index.php/Pkgfile#Command_not_found)
 - [macOS (Homebrew)](https://github.com/Homebrew/homebrew-command-not-found)
 - [Fedora](https://fedoraproject.org/wiki/Features/PackageKitCommandNotFound)
+- [NixOS](https://github.com/NixOS/nixpkgs/tree/master/nixos/modules/programs/command-not-found)
 
 You can add support for other platforms by submitting a Pull Request.

+ 7 - 0
plugins/command-not-found/command-not-found.plugin.zsh

@@ -31,3 +31,10 @@ if type brew &> /dev/null; then
     eval "$(brew command-not-found-init)";
   fi
 fi
+
+# NixOS command-not-found support
+if [ -x /run/current-system/sw/bin/command-not-found ]; then
+    command_not_found_handler () {
+        /run/current-system/sw/bin/command-not-found $@
+    }
+fi