Rofi plugin that nix-runs packages without installing them https://sr.ht/~fgaz/rofi-nix/
  • Tcl 77.9%
  • Nix 22.1%
Find a file
Francesco Gazzetta 7b1b500bf1 Rename rofi-nix.tcl to rofi-nix
So it can be installed without renaming it.
2026-05-14 15:27:40 +02:00
tests/scroll Add autoscroll 2025-11-06 14:19:05 +01:00
.gitignore Nixify 2025-07-25 00:48:13 +02:00
default.nix Nixify 2025-07-25 00:48:13 +02:00
flake.nix Nixify 2025-07-25 00:48:13 +02:00
LICENSE Add license 2025-07-25 00:23:37 +02:00
package.nix Rename rofi-nix.tcl to rofi-nix 2026-05-14 15:27:40 +02:00
README.md Rename rofi-nix.tcl to rofi-nix 2026-05-14 15:27:40 +02:00
rofi-nix Rename rofi-nix.tcl to rofi-nix 2026-05-14 15:27:40 +02:00

rofi-nix

Rofi plugin that nix-runs packages without installing them.

Prerequisites

Tcl/Tk, that's it 😎

…and Nix of course

Setup

  1. Put rofi-nix somewhere in your $PATH and make sure it's marked as executable. Alternatively, you can install it with Nix: there are both a flake and a classic package.nix/default.nix.
  2. Add a nix mode to your rofi configuration, for example by calling it with -modes "nix:rofi-nix" or by adding modes: ["nix:rofi-nix"] to your ~/config/rofi/config.rasi.
  3. Make sure to pin the nixpkgs flake with nix registry pin nixpkgs (and to re-pin it every once in a while), or startup will be slow every time nix decides to refresh the cache.
  4. Run rofi. The first run after a pin will take a while, but subsequent runs use a cache and are fast.

Configuration

By default rofi-nix looks for packages in the nixpkgs flake, at top level and in these package sets:

  • deepin
  • enlightenment
  • gnome
  • jetbrains
  • kdePackages
  • lomiri
  • lumina
  • lxde
  • lxqt
  • mate
  • pantheon
  • sweethome3d
  • xfce
  • xorg

You can change this by writing a list of flakes and package sets in $XDG_CONFIG_HOME/rofi-nix/flakes_package_sets. The format is flake1 {set1 set2} flake2 {set3 set4} (a Tcl dictionary). The amount of whitespace is irrelevant. The top level is always searched. For example:

nixpkgs {
  gnome
  kdePackages
}

nur {repos.fgaz}

git+https://example.com/my-repo.git {}

NOTE: Remember to pin the flakes you use, or startup will be slow every time nix decides to refresh the cache!

Contributing

Send a patch to this mailing list or a pull request to the Codeberg mirror.

Performance

The Rofi window will not show until rofi-nix is done listing, so $argc==0 performance is important and must be considered when working on that code path!

As a guideline, on a warm cache the nix flake metadata call should dominate the runtime of rofi-nix. For example, on my machine:

$ hyperfine -N "nix flake metadata --offline --json nixpkgs"
Benchmark 1: nix flake metadata --offline --json nixpkgs
  Time (mean ± σ):      40.3 ms ±   1.9 ms    [User: 24.1 ms, System: 11.3 ms]
  Range (min … max):    37.6 ms …  45.0 ms    70 runs

$ hyperfine -N rofi-nix
Benchmark 1: rofi-nix
  Time (mean ± σ):      61.2 ms ±   1.9 ms    [User: 38.0 ms, System: 17.5 ms]
  Range (min … max):    58.2 ms …  67.2 ms    47 runs