anchor.diff:      ''; # */
     };
   
  +  hwdbBin = stdenv.mkDerivation {
  +    name = "hwdb.bin";
  +
  +    preferLocalBuild = true;
  +    allowSubstitutes = false;
  +
  +    buildCommand = ''
  +      mkdir -p etc/udev/hwdb.d
  +      for i in ${toString ([udev] ++ cfg.packages)}; do
  +        echo "Adding hwdb files for package $i"
  +        for j in $i/{etc,lib}/udev/hwdb.d/*; do
  +          ln -s $j etc/udev/hwdb.d/$(basename $j)
  +        done
  +      done
  +
  +      echo "Generating hwdb database..."
  +      ${udev}/bin/udevadm hwdb --update --root=$(pwd)
  +      mv etc/udev/hwdb.bin $out
  +    '';
  +  };
  +
     # Udev has a 512-character limit for ENV{PATH}, so create a symlink
     # tree to work around this.
     udevPath = pkgs.buildEnv {
  
positive.code:           echo "" > /proc/sys/kernel/hotplug
          fi
  
          # Regenerate the hardware database /var/lib/udev/hwdb.bin
          # whenever systemd changes.
          if [ ! -e /var/lib/udev/prev-systemd -o "$(readlink /var/lib/udev/prev-systemd)" != ${config.systemd.package} ]; then
            echo "regenerating udev hardware database..."
            ${config.systemd.package}/bin/udevadm hwdb --update && ln -sfn ${config.systemd.package} /var/lib/udev/prev-systemd
          fi
  
          # Allow the kernel to find our firmware.
          if [ -e /sys/module/firmware_class/parameters/path ]; then
            echo -n "${config.hardware.firmware}/lib/firmware" > /sys/module/firmware_class/parameters/path
  
negative.code:     name = "extra-udev-rules";
      text = cfg.extraRules;
      destination = "/etc/udev/rules.d/10-local.rules";
    };
  
    extraHwdbFile = pkgs.writeTextFile {
      name = "extra-hwdb-file";
      text = cfg.extraHwdb;
      destination = "/etc/udev/hwdb.d/10-local.hwdb";
    };
  
    nixosRules = ''
  