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"; useRoutingFeatures = "both";
}; };
services.mozillavpn = {
enable = true;
};
services.xserver = { services.xserver = {
enable = true; enable = true;
layout = "us"; layout = "us";
@ -132,6 +136,13 @@
}; };
services.printing.enable = true; services.printing.enable = true;
services.printing.drivers = with pkgs; [
gutenprint
gutenprintBin
hplipWithPlugin
brlaser
brgenml1cupswrapper
];
sound.enable = true; sound.enable = true;
hardware.bluetooth.enable = true; hardware.bluetooth.enable = true;
@ -160,6 +171,8 @@
neovim neovim
vim vim
virt-manager virt-manager
virt-viewer
virt-top
wl-clipboard wl-clipboard
wget wget
]; ];
@ -182,6 +195,7 @@
# For SMB # For SMB
services.gvfs.enable = true; services.gvfs.enable = true;
services.avahi.enable = true; services.avahi.enable = true;
services.avahi.nssmdns = true;
## ##
services.openssh.enable = true; services.openssh.enable = true;
@ -192,7 +206,33 @@
# Samba # Samba
networking.firewall.extraCommands = ''iptables -t raw -A OUTPUT -p udp -m udp --dport 137 -j CT --helper netbios-ns''; 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; powerManagement.powertop.enable = true;
systemd.services.powertop.postStart = '' systemd.services.powertop.postStart = ''

24
flake.lock generated
View file

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

View file

@ -358,5 +358,33 @@ in {
TERMINAL = "alacritty"; 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"; home.stateVersion = "23.05";
} }

View file

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