how to find which packages are installed system-wide in NixOS?
There's no specific tool for this. You may like the system.copySystemConfiguration
option (see the docs for "caveats").
You'll get relatively close with nix-store -q --references /run/current-system/sw
– the list of nix store paths directly contained in systemPackages
, but note that various NixOS options may add packages in there.
Due to the approach NixOS takes on installing software, there's no such thing as a package which is installed system-wide. Not in the same sense of most package managers, that is.
However, if you treat a user environment (aka. profile) as the equivalent of system-wide, then you can use nix-store -q -R /nix/var/nix/profiles/system-${n}-link
to list the dependencies of a given user environment; where ${n}
is the profile's generation number. By dependencies, I mean direct and in-direct dependencies.
In addition, if you use the --tree
instead of -R
argument you can get an ASCII dependency tree.