# Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. { config, lib, pkgs, modulesPath, ... }: { imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; # 1) Make sure vfio and vfio_pci are in the initrd boot.initrd.kernelModules = [ "vfio" "vfio_pci" ]; # 2) Also load them again in the running system boot.kernelModules = [ "vfio" "vfio_pci" ]; # 3) Kernel params to turn on IOMMU and bind your card to vfio-pci boot.kernelParams = lib.mkForce [ # for AMD hosts (use the intel line if you’re on Intel) "amd_iommu=on" "iommu=pt" # helps isolate PCIe ports if your card shares groups "pci_acs_override=downstream,multifunction" # <<< the important bit: early vfio binding for 1b4b:9215 >>> "vfio-pci.ids=1b4b:9215" ]; boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "usbhid" "sd_mod" ]; boot.kernel.sysctl."net.ipv4.conf.all.forwarding" = true; swapDevices = [ { device = "/dev/disk/by-uuid/7e34cdc3-bd48-435a-8ea2-e1fe43926262"; } ]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's # still possible to use this option, but it's recommended to use it in conjunction # with explicit per-interface declarations with `networking.interfaces..useDHCP`. networking.useDHCP = lib.mkDefault true; # networking.interfaces.enp3s0.useDHCP = lib.mkDefault true; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; services.xserver.videoDrivers = [ "nvidia" ]; hardware.nvidia = { package = config.boot.kernelPackages.nvidiaPackages.legacy_470; modesetting.enable = true; powerManagement.enable = true; open = false; # <--- this must be false for proprietary nvidiaSettings = true; }; nixpkgs.config.allowUnfree = true; nixpkgs.config.nvidia.acceptLicense = true; }