Libvirt: Difference between revisions

imported>Fadenb
m xml syntax highlighting
imported>Wackbyte
fix some formatting and syntax highlighting
Line 14: Line 14:
If you would like to enable nested virtualization for your guests to run KVM hypervisors inside them, you should enable it as follows:  {{nixos:option|boot.extraModprobeConfig}}, for example:
If you would like to enable nested virtualization for your guests to run KVM hypervisors inside them, you should enable it as follows:  {{nixos:option|boot.extraModprobeConfig}}, for example:


<code>boot.extraModprobeConfig = "options kvm_intel nested=1";</code>
<syntaxhighlight lang="nix">
boot.extraModprobeConfig = "options kvm_intel nested=1";
</syntaxhighlight>


== Tools ==
== Tools ==
Line 32: Line 34:
It is possible to work around those issues without modifying the package (when a pristine nixpkgs is needed).
It is possible to work around those issues without modifying the package (when a pristine nixpkgs is needed).


<syntaxhighlight language=commands>
<syntaxhighlight lang="shell-session">
$ mkdir -p ~/.config/virt-builder
$ mkdir -p ~/.config/virt-builder
$ cd ~/.config/virt-builder
$ cd ~/.config/virt-builder
Line 57: Line 59:


<syntaxhighlight lang="xml">
<syntaxhighlight lang="xml">
    <graphics type='spice' port='5900' autoport='no' listen='0.0.0.0' keymap='de-ch' defaultMode='insecure'>
<graphics type='spice' port='5900' autoport='no' listen='0.0.0.0' keymap='de-ch' defaultMode='insecure'>
      <listen type='address' address='0.0.0.0'/>
  <listen type='address' address='0.0.0.0'/>
      <image compression='auto_lz'/>
  <image compression='auto_lz'/>
    </graphics>
</graphics>
</syntaxhighlight>
</syntaxhighlight>


Line 68: Line 70:


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
    services.networking.websockify = {
services.networking.websockify = {
        enable = true;
  enable = true;
        sslCert = "/https-cert.pem";
  sslCert = "/https-cert.pem";
        sslKey = "/https-key.pem";
  sslKey = "/https-key.pem";
        portMap = {
  portMap = {
            "5959" = 5900;
    "5959" = 5900;
        };
  };
    };
};
</syntaxhighlight>
</syntaxhighlight>


Line 96: Line 98:


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
    services.nginx = {
services.nginx = {
        enable = true;
  enable = true;
        virtualHosts."mydomain.tld" = {
  virtualHosts."mydomain.tld" = {
            forceSSL = true;
    forceSSL = true;
            root = "/var/www/";
    root = "/var/www/";
            locations."/spice/" = {
    locations."/spice/" = {
                index = "index.html index.htm";
      index = "index.html index.htm";
            };
    };
            locations."/websockify/" = {
    locations."/websockify/" = {
                proxyWebsockets = true;
      proxyWebsockets = true;
                proxyPass = "https://127.0.0.1:5959";
      proxyPass = "https://127.0.0.1:5959";
                extraConfig = ''
      extraConfig = ''
                    proxy_read_timeout 61s;
        proxy_read_timeout 61s;
                    proxy_buffering off;
        proxy_buffering off;
                '';
      '';
            };
            sslCertificate = "/https-cert.pem";
            sslCertificateKey = "/https-key.pem";
            listen =[ { addr = "*"; port = 45000; ssl = true; } ];
        };
     };
     };
    sslCertificate = "/https-cert.pem";
    sslCertificateKey = "/https-key.pem";
    listen = [ { addr = "*"; port = 45000; ssl = true; } ];
  };
};
</syntaxhighlight>
</syntaxhighlight>