One of the things I do often in nixos is installing packages into nix-env
. Stable and important packages go to configuration.nix, but with high-churn things I prefer to use ad hoc environment. I currently use nox
for this, and I am not really happy with workflow. Here are the papercuts I see:
- I type
nox something
, and have to wait some cache is updated. I’d love for the caches to persist across reboots, or to be build eagerly on system startup.
- I type
nox sublime-text
and get zero results. I’d love to be able to change the query string interactively, without restarting the command.
- I type
nox python
and get over nine thousand results. I’d like to have some interracive fuzzy narrowing.
Is there any tool I can use instead of nox to speed this up?
not sure if it’s best, but this is what I tend to go for:
nix-env -f ~/code/nixpkgs -qaP > /tmp/pkgs; nvim /tmp/pkgs
(search using vim facilities)
1 Like
I use nix-locate
for this:
$ nix-locate -w lspci
toybox.out 0 s /nix/store/gwr1sff02g55gw5fb70ck0p5bzp39ics-toybox-0.8.3/bin/lspci
pciutils.out 102,536 x /nix/store/yzkc62yi8n4iylqli0shkyl9s3g7sqrv-pciutils-3.7.0/bin/lspci
grc.out 291 r /nix/store/la7a7czdzgb93zfxgkcvmckgkdh1f9wf-grc-1.11.3/share/grc/conf.lspci
busybox.out 0 s /nix/store/cgvsmcmbxv1aszhhzy8b86gmas58bvbr-busybox-1.31.1/bin/lspci
(-w
(or --whole-name
) looks for exact filename matches, I found this to often be more useful for my usage-pattern of the tool.)
It at least solves the first point, because it yields instant results. You have to build a cache once which takes some minutes, but it definitely reduces friction. It doesn’t solve points 2&3 (it doesn’t do anything interactively), but point 3 could probably be solved by combining this (or any tool) with fzf
? If one or two invocations of nix-locate
are not enough, I usually also fall back to a project-wide search of my local nixpkgs
checkout.