Nixos-shell: Difference between revisions

Onny (talk | contribs)
Onny (talk | contribs)
Graphical session: Enable auto screen resize
 
(2 intermediate revisions by the same user not shown)
Line 58: Line 58:
   };
   };
};
};
</nowiki>|name=|lang=nix}}If you want clipboard-sharing to work between host and guest, append the following lines.{{file|3=<nowiki>
</nowiki>|name=|lang=nix}}If you want auto screen resize support and clipboard-sharing between host and guest to work, append the following lines to your guest config.{{file|3=<nowiki>
{ ... }: {
{ ... }: {
   [...]
   [...]
  nixpkgs.overlays = [
    (final: prev: {
      qemu = prev.qemu.overrideAttrs (old: {
        configureFlags = old.configureFlags ++ ["--enable-gtk-clipboard"];
      });
      qemu_kvm = prev.qemu_kvm.overrideAttrs (old: {
        configureFlags = old.configureFlags ++ ["--enable-gtk-clipboard"];
      });
    })
  ];


   virtualisation.qemu.options = [
   virtualisation.qemu.options = [
     "-spice" "port=5930,disable-ticketing=on"
     "-device virtio-vga-gl"
     "-device" "virtio-serial-pci"
     "-display gtk,gl=on"
     "-chardev" "spicevmc,id=vdagent,name=vdagent"
     "-chardev qemu-vdagent,id=vdagent,name=vdagent,clipboard=on"
     "-device" "virtserialport,chardev=vdagent,name=com.redhat.spice.0"
     "-device virtio-serial"
    "-device virtserialport,chardev=vdagent,name=com.redhat.spice.0"
   ];
   ];


Line 85: Line 97:


};
};
</nowiki>|name=|lang=nix}}On the host connect to the spice-enabled VM using this command<syntaxhighlight lang="bash">
</nowiki>|name=|lang=nix}}
nix shell nixpkgs#virt-viewer --command remote-viewer spice://localhost:5930
</syntaxhighlight>


=== Mounting host directories ===
=== Mounting host directories ===