Best way to confirm a module ran?

Hi there,

I have a module that does my network settings.

And through a series of imports, it looks like it’s not being run. Now, if I move some of the configuration to a different file, it works fine. It uses similar import methods.

In this case it’s just enabling network manager.

Now, not focussing in on network manager, what’s the best way to kind of test and or ensure that a module has been run and built properly? Especially if you’re not getting any sort of error output at the rebuild.

I get that you can, of course go in troubleshoot specific services, etc. But I’m more just talking about confirming that the Nix bits are doing what they should be.

Cheers.

To check if the module was ever evaluated at all, you can just put builtins.trace or nixpkgs.lib.traceIf before the module’s return value.

{ lib, ... }: lib.trace "module ran" {
  imports = [ ... ];
  options = {};
  config = { ... };
}

You can use Noogle – like Hoogle but for Nix to search for functions: noogle.dev

1 Like