materusPC: update settings, keep older linux-firmware

This commit is contained in:
Mateusz Słodkowicz 2023-07-03 21:52:23 +02:00
parent 377806748f
commit 7bea59425a
Signed by: materus
GPG Key ID: 28D140BCA60B4FD1
3 changed files with 123 additions and 171 deletions

View File

@ -3,10 +3,9 @@
#Kernel
boot.kernelPackages = pkgs.linuxPackages_zen;
boot.kernelParams = [ "nvme_core.default_ps_max_latency_us=0" "nvme_core.io_timeout=255" "nvme_core.max_retries=10" "nvme_core.shutdown_timeout=10" "amd_iommu=on" "iommu=pt" "pcie_acs_override=downstream,multifunction" ];
boot.kernelModules = [ "nbd" "i2c_dev" "kvm_amd" "vfio-pci" "v4l2loopback" "kvmfr" ];
boot.kernelModules = [ "i2c_dev" "kvm_amd" "vfio-pci" "v4l2loopback" "kvmfr" ];
boot.extraModprobeConfig = ''
options kvm_amd nested=1
options nbd max_part=16
'';
boot.kernel.sysctl = {"vm.max_map_count" = 1000000;};

View File

@ -1,4 +1,11 @@
{ config, pkgs, lib, inputs, materusFlake, materusPkgs, ... }:
let
pkg = import (builtins.fetchTarball {
name = "nixos-23.05";
url = "https://github.com/nixos/nixpkgs/archive/4ecab3273592f27479a583fb6d975d4aba3486fe.tar.gz";
sha256 = "sha256:10wn0l08j9lgqcw8177nh2ljrnxdrpri7bp0g7nvrsn9rkawvlbf";
}) {system = pkgs.system;};
in
{
imports =
[
@ -9,7 +16,7 @@
hardware.firmware = with pkgs; [
materusPkgs.amdgpu-pro-libs.firmware.vcn
materusPkgs.amdgpu-pro-libs.firmware
linux-firmware
pkg.linux-firmware
alsa-firmware
sof-firmware
];

View File

@ -101,20 +101,12 @@ in
};
virtualisation.libvirtd = {
enable = true;
onBoot = "ignore";
onShutdown = "shutdown";
qemu.ovmf.enable = true;
qemu.ovmf.packages = [ pkgs.OVMFFull.fd ];
qemu.runAsRoot = true;
qemu.swtpm.enable = true;
};
users.users.materus = {
isNormalUser = true;
extraGroups = [ "pipewire" "wheel" "networkmanager" "input" "kvm" "libvirt-qemu" "libvirt" "libvirtd" "podman" "lxd" ]; # Enable sudo for the user.
extraGroups = [ "audio" "video" "render" "pipewire" "wheel" "networkmanager" "input" "kvm" "libvirt-qemu" "libvirt" "libvirtd" "podman" "lxd" ]; # Enable sudo for the user.
shell = pkgs.bashInteractive;
description = "Mateusz Słodkowicz";
# packages = with pkgs; [
@ -318,7 +310,7 @@ in
];
/*
system.activationScripts.libvirt-hooks.text =
''
ln -Tfs /etc/libvirt/hooks /var/lib/libvirt/hooks
@ -327,56 +319,8 @@ in
environment.etc = {
"libvirt/hooks/qemu" = {
text =
''
#!/usr/bin/env bash
#
# Author: Sebastiaan Meijer (sebastiaan@passthroughpo.st)
#
# Copy this file to /etc/libvirt/hooks, make sure it's called "qemu".
# After this file is installed, restart libvirt.
# From now on, you can easily add per-guest qemu hooks.
# Add your hooks in /etc/libvirt/hooks/qemu.d/vm_name/hook_name/state_name.
# For a list of available hooks, please refer to https://www.libvirt.org/hooks.html
#
GUEST_NAME="$1"
HOOK_NAME="$2"
STATE_NAME="$3"
MISC="''${@:4}"
BASEDIR="$(dirname $0)"
HOOKPATH="$BASEDIR/qemu.d/$GUEST_NAME/$HOOK_NAME/$STATE_NAME"
set -e # If a script exits with an error, we should as well.
# check if it's a non-empty executable file
if [ -f "$HOOKPATH" ] && [ -s "$HOOKPATH"] && [ -x "$HOOKPATH" ]; then
eval \"$HOOKPATH\" "$@"
elif [ -d "$HOOKPATH" ]; then
while read file; do
# check for null string
if [ ! -z "$file" ]; then
eval \"$file\" "$@"
fi
done <<< "$(find -L "$HOOKPATH" -maxdepth 1 -type f -executable -print;)"
fi
'';
mode = "0755";
};
"libvirt/hooks/kvm.conf" = {
text =
''
VIRSH_GPU_VIDEO=pci_0000_01_00_0
VIRSH_GPU_AUDIO=pci_0000_01_00_1
VIRSH_GPU_USB=pci_0000_01_00_2
VIRSH_GPU_SERIAL_BUS=pci_0000_01_00_3
'';
mode = "0755";
};
"libvirt/hooks/qemu.d/win11/prepare/begin/start.sh" = {
text =
@ -514,4 +458,6 @@ in
};
"libvirt/vgabios/patched.rom".source = ./vbios.rom;
}; */
};
};
}