anchor.diff:        '';
       };
   
  +    package = mkOption {
  +      type = types.package;
  +      default = pkgs.libvirt;
  +      defaultText = "pkgs.libvirt";
  +      description = ''
  +        libvirt package to use.
  +      '';
  +    };
  +
       qemuPackage = mkOption {
         type = types.package;
         default = pkgs.qemu;
  
positive.code:       source = "/run/${dirName}/nix-helpers/qemu-bridge-helper";
      };
  
      systemd.packages = [ pkgs.libvirt ];
  
      systemd.services.libvirtd-config = {
        description = "Libvirt Virtual Machine Management Daemon - configuration";
        script = ''
          # Copy default libvirt network config .xml files to /var/lib
          # Files modified by the user will not be overwritten
          for i in $(cd ${pkgs.libvirt}/var/lib && echo \
              libvirt/qemu/networks/*.xml libvirt/qemu/networks/autostart/*.xml \
              libvirt/nwfilter/*.xml );
          do
              mkdir -p /var/lib/$(dirname $i) -m 755
              cp -npd ${pkgs.libvirt}/var/lib/$i /var/lib/$i
          done
  
          # Copy generated qemu config to libvirt directory
          cp -f ${qemuConfigFile} /var/lib/${dirName}/qemu.conf
  
          # stable (not GC'able as in /nix/store) paths for using in <emulator> section of xml configs
          for emulator in ${pkgs.libvirt}/libexec/libvirt_lxc ${cfg.qemuPackage}/bin/qemu-kvm ${cfg.qemuPackage}/bin/qemu-system-*; do
            ln -s --force "$emulator" /run/${dirName}/nix-emulators/
          done
  
  
negative.code: 
      systemd.services.virtlogd = {
        description = "Virtual machine log manager";
        serviceConfig.ExecStart = "@${cfg.package}/sbin/virtlogd virtlogd";
        restartIfChanged = false;
      };
  
  