# nix-search-tv Fuzzy search for NixOS packages. --- [](https://asciinema.org/a/afNYMXrhoEwwh3wzOK7FbsFtW)
## Searchable Things Out of the box, it is possible to search for things from: - [Nixpkgs](https://search.nixos.org/packages?channel=unstable) - [Home Manager](https://github.com/nix-community/home-manager) - [NixOS](https://search.nixos.org/options) - [Noogle](https://noogle.dev/) - [Darwin](https://github.com/LnL7/nix-darwin) - [NUR](https://github.com/nix-community/NUR) Also, you can search for arbitrary modules options and/or web pages. See [Custom Search](#custom-search) ## Usage `nix-search-tv` does not do the search by itself, but rather integrates with other general purpose fuzzy finders, such as [television](https://github.com/alexpasmantier/television) and [fzf](https://github.com/junegunn/fzf). This way, you can use it by piping results into fzf, embed into NeoVim, Emacs or anything else. Some examples [here](#examples) ### Television Add `nix.toml` file to your television cables directory with the content below: ```toml [metadata] name = "nix" requirements = ["nix-search-tv"] [source] command = "nix-search-tv print" [preview] command = "nix-search-tv preview {}" ``` or use the Home Manager option: ```nix programs.nix-search-tv.enableTelevisionIntegration = true; ``` ### fzf The most straightforward integration might look like: ```sh alias ns="nix-search-tv print | fzf --preview 'nix-search-tv preview {}' --scheme history" ``` There is also a [nixpkgs.sh](./nixpkgs.sh) script which provides more advanced fzf integration. It is the same search but with the following shortcuts: - Search only Nixpkgs or Home Manager - Jump to source code or homepage - Pipe preview to a pager to see documentation in full screen and select text - Search GitHub for snippets with the selected package/option - And more You can install it like: ```sh let ns = pkgs.writeShellScriptBin "ns" (builtins.readFile ./path/to/nixpkgs.sh); in { environment.systemPackages = [ ns ] } ``` ## Installation ### Nix Package ```nix environment.systemPackages = [ nix-search-tv ] ``` ### Flake There are many ways how one can install a package from a flake, below is one: ```nix { inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nix-search-tv.url = "github:3timeslazy/nix-search-tv"; }; outputs = { nixpkgs, nix-search-tv, ... }: { nixosConfigurations.system = nixpkgs.lib.nixosSystem { modules = [ { environment.systemPackages = [ nix-search-tv.packages.x86_64-linux.default ]; } ]; }; }; } ``` ### fzf + nixpkgs.sh by [tonybtw.com](https://www.tonybtw.com/community/nix-search-tv/) ```nix pkgs.writeShellApplication { name = "ns"; runtimeInputs = with pkgs; [ fzf nix-search-tv ]; text = builtins.readFile "${pkgs.nix-search-tv.src}/nixpkgs.sh"; } ``` ## Configuration By default, the configuration file is looked at `$XDG_CONFIG_HOME/nix-search-tv/config.json` ```jsonc { // What indexes to search by default // // default: // linux: [nixpkgs, "home-manager", "nur", "nixos"] // darwin: [nixpkgs, "home-manager", "nur", "darwin"] "indexes": ["nixpkgs", "nixos", "home-manager", "nur", "noogle"], // How often to look for updates and run // indexer again // // default: 1 week (168h) "update_interval": "3h2m1s", // Where to store the index files // // default: $XDG_CACHE_HOME/nix-search-tv "cache_dir": "path/to/cache/dir", // Whether to show the banner when waiting for // the indexing // // default: true "enable_waiting_message": true, // More about experimental below "experimental": { "render_docs_indexes": { "nix-on-droid": "https://nix-community.github.io/nix-on-droid/nix-on-droid-options.html", }, "options_file": { "agenix": "