virgil/vfio

This commit is contained in:
tulg 2025-10-22 17:48:49 +03:00
parent a4e5b89f0e
commit f58d2f9232
5 changed files with 94 additions and 72 deletions

View file

@ -1,30 +1,34 @@
# 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")
config,
lib,
pkgs,
modulesPath,
...
}: {
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "usb_storage" "sd_mod"];
boot.initrd.kernelModules = [];
boot.kernelModules = ["kvm-amd"];
boot.extraModulePackages = [];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/48340a1a-5055-4d72-b83b-db57a3a7e230";
fileSystems."/" = {
device = "/dev/disk/by-uuid/48340a1a-5055-4d72-b83b-db57a3a7e230";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/5292-3A27";
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/5292-3A27";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
options = ["fmask=0022" "dmask=0022"];
};
swapDevices = [ ];
swapDevices = [];
# 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

View file

@ -1,18 +1,19 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, self, ... }:
{
imports =
[ # Include the results of the hardware scan.
# ./disko.nix
config,
pkgs,
self,
...
}: {
imports = [
# Include the results of the hardware scan.
# ./disko.nix
./hardware-configuration.nix
./vfio.nix
];
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
@ -28,7 +29,12 @@
listen_addresses = ["127.0.0.1:53" "[::1]:53"];
};
};
virtualisation = {
libvirtd = {
enable = true;
qemuOvmf = true;
};
};
services.zapret = {
enable = true;
params = [
@ -59,7 +65,7 @@
users.users.tulg = {
isNormalUser = true;
description = "Tulga";
extraGroups = [ "networkmanager" "wheel" ];
extraGroups = ["networkmanager" "wheel"];
packages = with pkgs; [];
};
@ -110,9 +116,9 @@
fontconfig = {
enable = true;
defaultFonts = {
sansSerif = [ "Fira Sans Regular" ];
serif = [ "Fira Sans Regular" ];
monospace = [ "Fira Mono Regular" ];
sansSerif = ["Fira Sans Regular"];
serif = ["Fira Sans Regular"];
monospace = ["Fira Mono Regular"];
};
};
};
@ -134,8 +140,7 @@
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
nix.settings.experimental-features = [ "nix-command" "flakes"];
nix.settings.experimental-features = ["nix-command" "flakes"];
services.displayManager.ly.enable = true;
system.stateVersion = "25.05"; # Did you read the comment?
}

View file

@ -1,30 +1,34 @@
# 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 + "/profiles/qemu-guest.nix")
config,
lib,
pkgs,
modulesPath,
...
}: {
imports = [
(modulesPath + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "virtio_scsi" "sr_mod" "virtio_blk" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
boot.initrd.availableKernelModules = ["ahci" "xhci_pci" "virtio_pci" "virtio_scsi" "sr_mod" "virtio_blk"];
boot.initrd.kernelModules = [];
boot.kernelModules = ["kvm-amd"];
boot.extraModulePackages = [];
fileSystems."/" =
{ device = "/dev/disk/by-partlabel/disk-nixos-root";
fileSystems."/" = {
device = "/dev/disk/by-partlabel/disk-nixos-root";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-partlabel/disk-nixos-ESP";
fileSystems."/boot" = {
device = "/dev/disk/by-partlabel/disk-nixos-ESP";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
options = ["fmask=0022" "dmask=0022"];
};
swapDevices = [ ];
swapDevices = [];
# 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

10
hosts/virgil/vfio.nix Normal file
View file

@ -0,0 +1,10 @@
{
config,
pkgs,
...
}: {
boot.kernelparams = ["amd_iommu=on"];
boot.blacklistedKernelModules = ["nvidia" "nouveau"];
boot.kernelModules = ["vfio_virqfd" "vfio_pci" "vfio_iommu_type1" "vfio"];
boot.extraModprobeConfig = "options vfio-pci ids=10de:2705,10de:22bb";
}

View file

@ -1,6 +1,5 @@
{
config,
lib,
pkgs,
inputs,
...