How to explicity pass arguments config and pkgs to home-manager's NixOS module

It would be the final config of the home-manager instance of the module system, not the config attribute from Nixpkgs. You can do sort of η-expansion:

home-manager.users.myUser.imports = [
  ({ config, ... }: import ./home.nix {
    inherit config pkgs;
  })
]

But I would just recommend the solution suggested above, as it will have home-manager to inject the correct config.

If you want to learn how the module system works, I would recommend just reading its source code. See Import list in `configuration.nix` vs `import` function - #5 by jtojnar for where to start.

By the way, you do not need to include the config argument if you do not use it, the ellipsis will just swallow it.

1 Like