WIP: Add qemu

This commit is contained in:
Tristan D. 2023-09-25 21:01:34 +02:00
parent 0730b1828a
commit cfae461c46
Signed by: tristan
SSH key fingerprint: SHA256:U7y6eMb7CQDaTHv9XoX6/BaQnPqyxxKc+Xnfcefi6rY
5 changed files with 84 additions and 14 deletions

2
.directory Normal file
View file

@ -0,0 +1,2 @@
[Desktop Entry]
Icon=nix-snowflake-white

View file

@ -112,6 +112,10 @@
useRoutingFeatures = "both";
};
services.mozillavpn = {
enable = true;
};
services.xserver = {
enable = true;
layout = "us";
@ -132,6 +136,13 @@
};
services.printing.enable = true;
services.printing.drivers = with pkgs; [
gutenprint
gutenprintBin
hplipWithPlugin
brlaser
brgenml1cupswrapper
];
sound.enable = true;
hardware.bluetooth.enable = true;
@ -160,6 +171,8 @@
neovim
vim
virt-manager
virt-viewer
virt-top
wl-clipboard
wget
];
@ -182,6 +195,7 @@
# For SMB
services.gvfs.enable = true;
services.avahi.enable = true;
services.avahi.nssmdns = true;
##
services.openssh.enable = true;
@ -192,7 +206,33 @@
# Samba
networking.firewall.extraCommands = ''iptables -t raw -A OUTPUT -p udp -m udp --dport 137 -j CT --helper netbios-ns'';
virtualisation.libvirtd.enable = true;
virtualisation.libvirtd = {
enable = true;
onShutdown = "suspend";
onBoot = "ignore";
qemu = {
package = pkgs.qemu_kvm;
ovmf.enable = true;
ovmf.packages = [pkgs.OVMFFull.fd];
swtpm.enable = true;
runAsRoot = false;
};
};
# virtualisation.libvirtd.allowedBridges = [
# "virbr0"
# "testbr0"
# ];
# networking.bridges = {
# testbr0 = {
# interfaces = [
# "enp5s0f4u1u1c2"
# ];
# };
# };
powerManagement.powertop.enable = true;
systemd.services.powertop.postStart = ''

24
flake.lock generated
View file

@ -7,11 +7,11 @@
]
},
"locked": {
"lastModified": 1695604864,
"narHash": "sha256-fDdXFT6nBN7jFobQpofOnp/0KIwZbWj8pnx+VUjnP8k=",
"lastModified": 1695660337,
"narHash": "sha256-4ceXFNIUphgqFo4BR0bUEKh65Lud4x5DF/mB/eDdqEI=",
"owner": "nix-community",
"repo": "disko",
"rev": "021f2a6fbec292d37caaf37517f7d3cd5e584551",
"rev": "fbfd7567c224134b57ee64a663e95285fe7fe048",
"type": "github"
},
"original": {
@ -29,11 +29,11 @@
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1695612850,
"narHash": "sha256-XHndbQIku+3wFuvQj8gkKWuLTbS+BP8j3s41oAJ/wMo=",
"lastModified": 1695667627,
"narHash": "sha256-3scmlAWduBQJELvQtAknQ6M2g5hnb0kY1stTOFeTk30=",
"owner": "nix-community",
"repo": "emacs-overlay",
"rev": "5f0b496aa00886a17cf42faa94dce57e0f7ab20c",
"rev": "d1a316b529df678413ba05c970c0c9bdcb6c0d37",
"type": "github"
},
"original": {
@ -210,11 +210,11 @@
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1695416179,
"narHash": "sha256-610o1+pwbSu+QuF3GE0NU5xQdTHM3t9wyYhB9l94Cd8=",
"lastModified": 1695559356,
"narHash": "sha256-kXZ1pUoImD9OEbPCwpTz4tHsNTr4CIyIfXb3ocuR8sI=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "715d72e967ec1dd5ecc71290ee072bcaf5181ed6",
"rev": "261abe8a44a7e8392598d038d2e01f7b33cf26d0",
"type": "github"
},
"original": {
@ -258,11 +258,11 @@
},
"nur": {
"locked": {
"lastModified": 1695629172,
"narHash": "sha256-uyX3hb9n8O4DdtRLi3VsNLhhgsgV0NwDC0AJ3FT61rI=",
"lastModified": 1695667635,
"narHash": "sha256-8i1CYSn26gt9Psjzac/OXw8vuirM+lclKrlxSfVKEuk=",
"owner": "nix-community",
"repo": "NUR",
"rev": "d68e23fbf48d0ac738fccb263ba30c7c3441cbe8",
"rev": "013bd502966a0bca732b03c9c88a487bad6c0d67",
"type": "github"
},
"original": {

View file

@ -358,5 +358,33 @@ in {
TERMINAL = "alacritty";
};
xdg.desktopEntries = {
win10 = {
name = "Win 10 VM";
type = "Application";
icon = "windows";
comment = "start the win10 vm";
exec = pkgs.lib.strings.concatStrings [
"bash -c \""
"virsh --connect=qemu:///system start win10; "
"virt-viewer -a -w -c qemu:///system win10 "
"&& virsh --connect=qemu:///system managedsave win10\""
];
};
win11 = {
name = "Win 11 VM";
type = "Application";
icon = "windows";
comment = "start the win11 vm";
exec = pkgs.lib.strings.concatStrings [
"bash -c \""
"virsh --connect=qemu:///system start win11; "
"virsh --connect=qemu:///system resume win11; "
"virt-viewer -a -w -c qemu:///system win11 "
"&& virsh --connect=qemu:///system managedsave win11\""
];
};
};
home.stateVersion = "23.05";
}

View file

@ -8,7 +8,7 @@
users.users.tristand = {
isNormalUser = true;
description = "Tristan Druyen";
extraGroups = ["networkmanager" "wheel" "libvirtd"];
extraGroups = ["networkmanager" "wheel" "libvirtd" "qemu-libvirtd"];
shell = pkgs.fish;
home = "/home/tristand";
hashedPassword = "$6$Wj.XY8JgH5EWuog4$HnbtPJXDEqKXFrzkPVEjih3PytcpBCrkfL7TAwkXd0IFced7kGMlZNliNsAqQ3XqfyUzAYiiKTIqoPVJEk.s..";