Terminal utility built with ncurses for looking up Nix store paths in binary caches and viewing their NAR info metadata.
- Very small binary (< 30kb)
- Interactive TUI for browsing narinfo contents
- Support for multiple binary caches
- Direct executable lookup without prompts
- Clipboard integration for copying narinfo lines
# Interactive mode
narnia
# Direct lookup
narnia /nix/store/path/to/executable # absolute path
narnia git # from PATH
# With additional caches
narnia -c https://mycache.cachix.org git
narnia -c https://cache1.example.com -c https://cache2.example.com-c, --cache URL Add cache URL (can be used multiple times)
-h, --help Show help message
Narnia provides a set of keyboard controls while you are in the interactive TUI.
- Tab/Shift-Tab: Switch between cache results
- Up/Down: Navigate narinfo lines
- PgUp/PgDn: Jump pages
- Enter: Copy selected line to clipboard
- r: Retry with new input
- q: Quit
The tool automatically uses https://cache.nixos.org as the default cache.
Additional caches can be specified with the -c flag and will be queried in the
order provided.
For executables found in PATH, the tool resolves the full Nix store path,
extracts the hash, and queries each cache for the corresponding nar info file.
This program depends on curl for network requests and ncurses for the terminal UI. Narnia used to depend on libclipboard, but it has proven ineffective on Wayland systems and has been replaced with a local implementation for cross-protocol copy feature.
libcurlncurses
Once you confirm that you have acquired the relevant dependencies, build with Zig.
zig build -Doptimize=ReleaseSmallThis will automatically optimize the binary for release, with a focus on smaller binary sizes. You may experiment with release modes if you'd like, e.g., a "faster" binary but the speed doesn't seem to change much.
You can, of course, choose to build with gcc if that is what you prefer.
gcc -o narnia main.c -lcurl -lncurses -lclipboardThe recommended way of using and installing Narnia is through the Nix build tool. This much should be obvious since it is, well, to query Nix Archives (NARs). In most cases you are recommended to use one of
nix profile addenvironment.systemPackages
using the flake provided by this repository in order to make the
narnia command available in your system. In the case you want to install this
tool through traditional means, you may run:
zig build install --prefix /usr/local