NixOS modules can be paths. Rather than dig further down into the layer violation, don't check anything specific to NixOS modules.