Manage nix roots outside of the usual locations, for non-nix-native development

c9d1d3d GitHub -> Codeberg

~fgaz pushed to ~fgaz/orchid git

21 days ago

3aea6d0 Don't use the filesystem as a poor man's database

~fgaz pushed to ~fgaz/orchid git

21 days ago


This program was made to solve the problem resulting from the following sequence of events:

  • Enter a nix-shell -p $library, where $library is needed for development
  • In the shell, build some $program, which links with, or makes use of, $library
  • Exit the shell, run nix-collect-garbage
  • $program now lacks $library and breaks

Orchid scans the given paths for references to the nix store and pins whatever it finds.

In other words, it makes nix take roots outside of the store+environments, hence the name.

Other nice features are:

  • Fast, incremental scanning
  • Simple filesystem-based root database


Both a traditional default.nix and a flake are provided. Install with:

$ nix-env -f . -i


nix install

Nix >=2.4 with the nix-command feature enabled is required.


To scan PATH for references and pin them, run

orchid pin PATH

Use the --help flag to see more options.


You can send patches to my public-inbox mailing list or to any of the contacts listed at fgaz.me/about. Or you can send a pull request to the Codeberg mirror.

Issues are tracked at https://todo.sr.ht/~fgaz/orchid