From 8055d2c8c1424f2ed32585698aabaa0647a47ed9 Mon Sep 17 00:00:00 2001 From: blahai Date: Mon, 28 Oct 2024 17:18:56 +0200 Subject: [PATCH] Global: fix pci passtrough. Nyx: bunch of old changes --- hosts/nyx/configuration.nix | 28 +++++++--------------- hosts/nyx/hardware-configuration.nix | 4 ++-- modules/nixos/virtualisation.nix | 35 +++++++++++++++++++--------- 3 files changed, 34 insertions(+), 33 deletions(-) diff --git a/hosts/nyx/configuration.nix b/hosts/nyx/configuration.nix index 511cf1c..d28b786 100644 --- a/hosts/nyx/configuration.nix +++ b/hosts/nyx/configuration.nix @@ -19,7 +19,7 @@ }; efi.canTouchEfiVariables = true; }; - kernelPackages = pkgs.linuxPackages_cachyos; + kernelPackages = pkgs.linuxPackages_zen; kernel = { sysctl ={ "vm.max_map_count" = 2147483642; @@ -27,13 +27,6 @@ }; }; - virtualisation = { - docker = { - enable = true; - storageDriver = "btrfs"; - }; - }; - zramSwap = { enable = true; algorithm = "zstd"; @@ -82,20 +75,9 @@ }; }; - cloudflared = { - enable = true; - }; - gnome.gnome-keyring.enable = true; - pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - jack.enable = true; }; - }; hardware.pulseaudio.enable = false; security.rtkit.enable = true; @@ -103,7 +85,7 @@ users.users.pingu = { isNormalUser = true; description = "Elissa"; - extraGroups = [ "networkmanager" "wheel" "docker" ]; + extraGroups = [ "networkmanager" "wheel" "input" "render" ]; shell = pkgs.fish; packages = with pkgs; [ floorp @@ -192,12 +174,16 @@ }; }; + qt.enable = true; + environment.systemPackages = with pkgs; [ age ssh-to-age sops cloudflared inputs.zen-browser.packages."${pkgs.system}".specific + cava + socat btrfs-progs btop hyprcursor @@ -243,6 +229,8 @@ material-design-icons material-symbols imagemagick + wireguard-tools + mission-center ]; fonts.packages = with pkgs; [ diff --git a/hosts/nyx/hardware-configuration.nix b/hosts/nyx/hardware-configuration.nix index cffd4ed..0fec83e 100644 --- a/hosts/nyx/hardware-configuration.nix +++ b/hosts/nyx/hardware-configuration.nix @@ -9,8 +9,8 @@ ]; boot.initrd.availableKernelModules = [ "nvme" "ahci" "xhci_pci" "usbhid" "hid_generic" "uas" "sd_mod" ]; - boot.initrd.kernelModules = [ "amdgpu" ]; - boot.kernelModules = [ "kvm-amd" "amd-pstate" "amdgpu" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" "amd-pstate" ]; boot.extraModulePackages = [ ]; fileSystems."/" = diff --git a/modules/nixos/virtualisation.nix b/modules/nixos/virtualisation.nix index f937eb3..7632661 100644 --- a/modules/nixos/virtualisation.nix +++ b/modules/nixos/virtualisation.nix @@ -1,12 +1,23 @@ { pkgs, lib, config, ... }: -let - platform = "amd"; - vfioIds = [ "" "" ]; -in { +{ boot = { - kernelModules = [ "kvm-${platform}" "vfio_virqfd" "vfio_pci" "vfio_iommu_type1" "vfio" ]; - kernelParams = [ "${platform}_iommu=on" "${platform}_iommu=pt" "kvm.ignore_msrs=1" ]; - extraModprobeConfig = "options vfio-pci ids=${builtins.concatStringsSep "," vfioIds}"; + initrd.kernelModules = lib.mkBefore [ + "kvm-amd" + "vfio_pci" + "vfio_iommu_type1" + "vfio" + + "amdgpu" + ]; + kernelParams = [ + "amd_iommu=on" + "amd_iommu=pt" + "kvm.ignore_msrs=1" + "vfio-pci.ids=1002:67df,1002:aaf0" + ]; + extraModprobeConfig = '' + softdep drm pre: vfio-pci + ''; }; virtualisation = { @@ -14,11 +25,11 @@ in { enable = true; onBoot = "ignore"; onShutdown = "shutdown"; - }; - qemu = { - package = pkgs.qemu_kvm; - ovmf.enable = true; + qemu = { + package = pkgs.qemu_kvm; + ovmf.enable = true; + }; }; docker = { @@ -26,6 +37,8 @@ in { }; }; + users.users.pingu.extraGroups = [ "qemu-libvirtd" "libvirtd" "disk" "kvm" "docker" ]; + environment.systemPackages = with pkgs; [ virt-manager ];