Virt-manager: Difference between revisions

From NixOS Wiki
imported>Zaechus
m (Minor grammar and formatting changes)
imported>Timokau
(Add declarative way of configuring the default hypervisor.)
Line 22: Line 22:
Connect
Connect
</pre>
</pre>
The same can also be achieved decoratively by setting the corresponding dconf settings with home-manager. If you want to do this instead of the imperative configuration described above, add the following snippet to your home-manager configuration:
<syntaxhighlight lang="nix">
dconf.settings = {
  "org/virt-manager/virt-manager/connections" = {
    autoconnect = ["qemu:///system"];
    uris = ["qemu:///system"];
  };
};
</syntaxhighlight>


You can get the following error :  
You can get the following error :  

Revision as of 13:47, 2 August 2023

Installation

NixOS

virtualisation.libvirtd.enable = true;
programs.dconf.enable = true;
environment.systemPackages = with pkgs; [ virt-manager ];

You will get a warning when you open it for the first time

Could not detect a default hypervisor. Make sure the appropriate virtualization packages containing kvm, qemu, libvirt, etc. are installed and that libvirtd is running.

To resolve

File (in the menu bar) -> Add connection

HyperVisor = QEMU/KVM
Autoconnect = checkmark

Connect

The same can also be achieved decoratively by setting the corresponding dconf settings with home-manager. If you want to do this instead of the imperative configuration described above, add the following snippet to your home-manager configuration:

dconf.settings = {
  "org/virt-manager/virt-manager/connections" = {
    autoconnect = ["qemu:///system"];
    uris = ["qemu:///system"];
  };
};

You can get the following error :

authentication unavailable: no polkit agent available to authenticate action 'org.libvirt.unix.manage'

To resolve, add the user to the libvirtd group.

{
  users.users.<myuser>.extraGroups = [ "libvirtd" ];
}