I can't figure out how to use a nix file from a module

I have 2 files:

pxe.nix (the module) and netboot.nix.

I want the module to build netboot.nix and use it like this:

let
  netboot = pkgs.callPackage ./netboot.nix {};
in
[...]
kernel = "${netboot}/bzImage";

I can build netboot.nix fine by running nix-build -E 'with import <nixpkgs> {}; callPackage ./netboot.nix {}' but if I try to build the module with nixos-rebuildI get:

$ sudo nixos-rebuild switch -I nixpkgs=~/nixpkgs
building Nix...
building the system configuration...
error: file '/home/bbigras/nixpkgs/nixos/tests/vde1.ctl/.05386-00000' has an unsupported type
(use '--show-trace' to show detailed location information)

Any ideas?

@grahamc I htink you did some work with PXE stuff

Sometimes when running tests manually the vde1.ctl directory is left over that causes this error. I have no idea why this happens but rm -rf vde1.ctl worked for me.

Edit: reproducer:

$ cd nixpkgs/nixos/tests
$ ls -d *vde* 
zsh: no matches found: *vde*
$ nix-build mediawiki.nix -A driver
/nix/store/n2g5j05na0lqakajji2injv4b2dx2rdh-nixos-test-driver-mediawiki
$ ./result/bin/nixos-test-driver
starting VDE switch for network 1
>>> exit()                                                                                                                                                     
cleaning up
(0.00 seconds)
$ ls -d *vde*
vde1.ctl

Edit 2: proposed fix:

That was it.

Thanks everyone.