virtualisation: restructure kvm module options and enable libvirt by default

This commit is contained in:
Kabbone 2024-05-02 09:56:41 +02:00
parent 08aa2cd458
commit 62acac7285
Signed by: Kabbone
SSH Key Fingerprint: SHA256:A5zPB5I6u5V78V51c362BBdCwhDhfDUVbt7NfKdjWBY
9 changed files with 39 additions and 18 deletions

View File

@ -22,11 +22,10 @@
{
imports = # For now, if applying to other system, swap files
[(import ./hardware-configuration.nix)] ++ # Current system hardware config @ /etc/nixos/hardware-configuration.nix
#[(import ../../modules/desktop/hyprland/default.nix)] ++ # Window Manager
[(import ../../modules/desktop/sway/default.nix)] ++ # Window Manager
#[(import ../../modules/editors/nvim/config/default.nix)] ++ # Window Manager
(import ../../modules/desktop/virtualisation) ++ # Docker
(import ../../modules/hardware); # Hardware devices
[(import ../../modules/desktop/sway/default.nix)] ++ # Window Manager
(import ../../modules/desktop/virtualisation) ++ # libvirt + Docker
[(import ../../modules/desktop/virtualisation/kvm-amd)] ++ # kvm module options
(import ../../modules/hardware); # Hardware devices
boot = { # Boot options
kernelPackages = pkgs.linuxPackages_latest;

View File

@ -23,6 +23,7 @@
imports = # For now, if applying to other system, swap files
[(import ./hardware-configuration.nix)] ++ # Current system hardware config @ /etc/nixos/hardware-configuration.nix
[(import ../../modules/desktop/virtualisation/docker.nix)] ++ # Docker
[(import ../../modules/desktop/virtualisation/kvm-amd.nix)] ++ # kvm module options
(import ../../modules/services/server) ++ # Server Services
(import ../../modules/hardware); # Hardware devices

View File

@ -25,6 +25,7 @@
#[(import ../../modules/desktop/hyprland/default.nix)] ++ # Window Manager
[(import ../../modules/desktop/sway/default.nix)] ++ # Window Manager
[(import ../../modules/desktop/virtualisation/docker.nix)] ++ # Docker
[(import ../../modules/desktop/virtualisation/kvm-intel.nix)] ++ # kvm module options
(import ../../modules/hardware); # Hardware devices
boot = { # Boot options

View File

@ -22,7 +22,7 @@
{
imports = # For now, if applying to other system, swap files
[(import ./hardware-configuration.nix)] ++ # Current system hardware config @ /etc/nixos/hardware-configuration.nix
(import ../../modules/desktop/virtualisation) ++ # Docker
#[(import ../../modules/desktop/virtualisation/docker.nix)] ++ # Docker
(import ../../modules/services/nasbackup) ++ # Server Services
(import ../../modules/hardware); # Hardware devices

View File

@ -22,10 +22,11 @@
{
imports = # For now, if applying to other system, swap files
[(import ./hardware-configuration.nix)] ++ # Current system hardware config @ /etc/nixos/hardware-configuration.nix
[(import ../../modules/desktop/steam/default.nix)] ++ # Window Manager
[(import ../../modules/desktop/kde/default.nix)] ++ # Window Manager
[(import ../../modules/desktop/virtualisation/docker.nix)] ++ # Docker
(import ../../modules/hardware); # Hardware devices
[(import ../../modules/desktop/steam/default.nix)] ++ # jovian steam
[(import ../../modules/desktop/kde/default.nix)] ++ # Window Manager
(import ../../modules/desktop/virtualisation) ++ # libvirt + Docker
[(import ../../modules/desktop/virtualisation/kvm-amd.nix)] ++ # kvm module options
(import ../../modules/hardware); # Hardware devices
boot = { # Boot options
loader = { # EFI Boot
@ -87,5 +88,5 @@
tailscale.enable = true;
};
security.pam.enableSSHAgentAuth = true;
security.pam.sshAgentAuth.enable = true;
}

View File

@ -13,5 +13,5 @@
[
./docker.nix
# ./qemu.nix
./qemu.nix
]

View File

@ -0,0 +1,12 @@
#
# KVM module options amd
#
{ config, pkgs, user, ... }:
{ # Add libvirtd and kvm to userGroups
boot.extraModprobeConfig = ''
options kvm_amd nested=0 avic=1 npt=1
''; # Needed to run OSX-KVM
}

View File

@ -0,0 +1,13 @@
#
# KVM module options intel
#
{ config, pkgs, user, ... }:
{ # Add libvirtd and kvm to userGroups
boot.extraModprobeConfig = ''
options kvm_intel nested=1
options kvm_intel emulate_invalid_guest_state=0
options kvm ignore_nsrs=1
''; # Needed to run OSX-KVM
}

View File

@ -5,12 +5,6 @@
{ config, pkgs, user, ... }:
{ # Add libvirtd and kvm to userGroups
boot.extraModprobeConfig = ''
options kvm_intel nested=1
options kvm_intel emulate_invalid_guest_state=0
options kvm ignore_nsrs=1
''; # Needed to run OSX-KVM
users.groups.libvirtd.members = [ "root" "${user}" ];
virtualisation = {