Setting an option without importing the appropriate package

I’ve set up guest extensions on VMWare, by adding the following to my configuration.nix:

virtualisation.vmware.guest.enable = true;

But what is interesting is that when I comment the actual vmware-guest.nix file from my import list like so:

imports = 
  [ 
    # <nixpkgs/nixos/modules/virtualisation/vmware-guest.nix>
  ];

sudo nixos-rebuild test everything runs fine.

Is there some implicit thing where defining the option imports the appropriate nix file, or is this just silently failing as I’m basically defining a new variable that isn’t referenced elsewhere?

This file defines the default modules imported by the NixOS^1. So you don’t have to explicitly add <nixpkgs/nixos/modules/virtualisation/vmware-guest.nix> to imports to be able to define virtualisation.vmware.guest.enable = true;.

If you really want to disable importing a default module (for example to replace it with a one from different channel), you can use disabledModules^2.

1 Like