How to get current NixOS option definition?

In a running NixOS system, how does one get the current value applied to a certain option?

From the running generation, I don’t think you can, unless you’ve set up some method to record the configuration with the generation. Nixos doesn’t do that by default.

From the config as stored in /etc/nixos, you can do nix-instantiate --eval --expr '(import <nixpkgs/nixos> {})'.

1 Like