From ab43f858ea70db52b5f325dd0b17f459505fea1d Mon Sep 17 00:00:00 2001 From: materus Date: Fri, 10 May 2024 18:12:05 +0200 Subject: [PATCH] materusPC: ssh changes, vm changes, steam changes --- configurations/host/materusPC/apps.nix | 1 - .../host/materusPC/hardware/boot.nix | 15 +++++++++++++- .../host/materusPC/hardware/default.nix | 6 +++--- .../host/materusPC/home/materus/default.nix | 2 -- configurations/host/materusPC/tmp.nix | 15 ++++++++++++-- .../host/materusPC/vm/win10/default.nix | 20 +++++++++---------- configurations/profile/os/games/steam.nix | 4 +++- 7 files changed, 42 insertions(+), 21 deletions(-) diff --git a/configurations/host/materusPC/apps.nix b/configurations/host/materusPC/apps.nix index 0c2b250..8d6de81 100644 --- a/configurations/host/materusPC/apps.nix +++ b/configurations/host/materusPC/apps.nix @@ -1,7 +1,6 @@ {config, pkgs, materusArg, ...}: { environment.systemPackages = with pkgs; [ - gamescope #(pkgs.lutris.override { extraLibraries = pkgs: with pkgs; [ pkgs.samba pkgs.jansson pkgs.tdb pkgs.libunwind pkgs.libusb1 pkgs.gnutls pkgs.gtk3 pkgs.pango ]; }) materusArg.pkgs.amdgpu-pro-libs.prefixes (pkgs.bottles.override { extraPkgs = pkgs: [ pkgs.libsForQt5.breeze-qt5 pkgs.kdePackages.breeze-gtk pkgs.nss_latest ]; extraLibraries = pkgs: [ pkgs.samba pkgs.jansson pkgs.tdb pkgs.libunwind pkgs.libusb1 pkgs.gnutls pkgs.gtk3 pkgs.pango ]; }) diff --git a/configurations/host/materusPC/hardware/boot.nix b/configurations/host/materusPC/hardware/boot.nix index 42e40ab..d6fbd03 100644 --- a/configurations/host/materusPC/hardware/boot.nix +++ b/configurations/host/materusPC/hardware/boot.nix @@ -17,7 +17,20 @@ in { #Kernel boot.kernelPackages = pkgs.linuxPackages_zen; - boot.kernelParams = [ "rcu_nocbs=${materusArg.materusPC.vmCores}" "nohz_full=${materusArg.materusPC.vmCores}" "vfio_iommu_type1.allow_unsafe_interrupts=1" "pcie_acs_override=downstream,multifunction" /*"pci-stub.ids=1002:744c"*/ "nox2apic" "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" ] ++ video; + boot.kernelParams = [ + "rcu_nocbs=${materusArg.materusPC.vmCores}" + "nohz_full=${materusArg.materusPC.vmCores}" + "vfio_iommu_type1.allow_unsafe_interrupts=1" + "pcie_acs_override=downstream,multifunction" /*"pci-stub.ids=1002:744c"*/ + "nox2apic" + "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" + "amdgpu.ppfeaturemask=0xffffffff" + "iommu=pt" + ] ++ video; boot.kernelModules = [ "pci-stub" "amdgpu" "i2c_dev" "kvm_amd" "vfio" "vfio_iommu_type1" "vfio-pci" ]; boot.extraModprobeConfig = '' options kvm_amd nested=1 avic=1 npt=1 sev=0 diff --git a/configurations/host/materusPC/hardware/default.nix b/configurations/host/materusPC/hardware/default.nix index aeb981a..41dcb99 100644 --- a/configurations/host/materusPC/hardware/default.nix +++ b/configurations/host/materusPC/hardware/default.nix @@ -8,7 +8,7 @@ ]; hardware.firmware = with pkgs; [ materusArg.pkgs.amdgpu-pro-libs.firmware.vcn - #materusArg.pkgs.amdgpu-pro-libs.firmware + materusArg.pkgs.amdgpu-pro-libs.firmware linux-firmware alsa-firmware sof-firmware @@ -44,12 +44,12 @@ materusArg.pkgs.i686Linux.amdgpu-pro-libs.vulkan libvdpau-va-gl ]; - services.udev.extraRules = '' + /*services.udev.extraRules = '' #GPU bar size ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x1002", ATTR{device}=="0x744c", ATTR{resource0_resize}="15" ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x1002", ATTR{device}=="0x744c", ATTR{resource2_resize}="8" - ''; + '';*/ #Trim diff --git a/configurations/host/materusPC/home/materus/default.nix b/configurations/host/materusPC/home/materus/default.nix index 7cfa320..3f6de1a 100644 --- a/configurations/host/materusPC/home/materus/default.nix +++ b/configurations/host/materusPC/home/materus/default.nix @@ -97,8 +97,6 @@ xdg.desktopEntries.brave-browser = let env = lib.concatStringsSep " " [ - ''DRI_PRIME="1002:744c"'' - ''MESA_VK_DEVICE_SELECT="1002:744c"'' ''NIXOS_OZONE_WL="1"'' ]; script = pkgs.writeShellScript "brave" '' diff --git a/configurations/host/materusPC/tmp.nix b/configurations/host/materusPC/tmp.nix index d9166c4..b64f150 100644 --- a/configurations/host/materusPC/tmp.nix +++ b/configurations/host/materusPC/tmp.nix @@ -6,7 +6,7 @@ virtualisation.lxd.enable = true; programs.gamemode.enable = true; - + programs.corectrl.enable = true; @@ -90,6 +90,7 @@ ]; shell = pkgs.zsh; description = "Mateusz Słodkowicz"; + openssh.authorizedKeys.keyFiles = [ ("${materusArg.cfg.path}" + "/extraFiles/keys/ssh/materus.pub") ]; }; environment.sessionVariables = { @@ -120,7 +121,7 @@ services.pcscd.enable = true; - + services.samba-wsdd.enable = true; services.samba-wsdd.openFirewall = true; services.samba = { @@ -160,6 +161,16 @@ }; programs.ssh.startAgent = true; services.openssh.enable = true; + services.openssh.settings.PermitRootLogin = "no"; + services.openssh.settings.PasswordAuthentication = false; + services.openssh.openFirewall = true; + + services.sunshine = { + enable = true; + capSysAdmin = true; + openFirewall = true; + autoStart = false; + }; environment.enableAllTerminfo = true; environment.pathsToLink = [ "/share/zsh" "/share/bash-completion" "/share/fish" ]; diff --git a/configurations/host/materusPC/vm/win10/default.nix b/configurations/host/materusPC/vm/win10/default.nix index 8044e50..27494dd 100644 --- a/configurations/host/materusPC/vm/win10/default.nix +++ b/configurations/host/materusPC/vm/win10/default.nix @@ -82,7 +82,16 @@ let # exec 3>&1 4>&2 # trap 'exec 2>&4 1>&3' 0 1 2 3 # exec 1>/home/materus/stoplogfile.out 2>&1 + echo performance | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor + sysctl vm.stat_interval=1 + sysctl -w kernel.watchdog=1 + echo "${materusArg.materusPC.allCoresMask}" > /proc/irq/default_smp_affinity + for irq in /proc/irq/[0-9]*/smp_affinity; do + if [ $(cat $irq) = "${materusArg.materusPC.hostCoresMask}" ] || [ $(cat $irq) = "${materusArg.materusPC.vmCoresMask}" ]; then + echo "${materusArg.materusPC.allCoresMask}" > $irq 2> /dev/null + fi; + done; sleep 1s @@ -107,17 +116,6 @@ let systemctl set-property --runtime -- system.slice AllowedCPUs=${materusArg.materusPC.allCores} systemctl set-property --runtime -- init.scope AllowedCPUs=${materusArg.materusPC.allCores} echo "${materusArg.materusPC.allCoresMask}" > /sys/bus/workqueue/devices/writeback/cpumask - echo powersave | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor - - sysctl vm.stat_interval=1 - sysctl -w kernel.watchdog=1 - echo "${materusArg.materusPC.allCoresMask}" > /proc/irq/default_smp_affinity - for irq in /proc/irq/[0-9]*/smp_affinity; do - if [ $(cat $irq) = "${materusArg.materusPC.hostCoresMask}" ] || [ $(cat $irq) = "${materusArg.materusPC.vmCoresMask}" ]; then - echo "${materusArg.materusPC.allCoresMask}" > $irq 2> /dev/null - fi; - done; - ''; in diff --git a/configurations/profile/os/games/steam.nix b/configurations/profile/os/games/steam.nix index 994ff73..90fe3c2 100644 --- a/configurations/profile/os/games/steam.nix +++ b/configurations/profile/os/games/steam.nix @@ -11,7 +11,6 @@ let pkgs.keyutils pkgs.libGL pkgs.libglvnd - pkgs.gamescope pkgs.steamPackages.steam pkgs.libxcrypt pkgs.gnutls @@ -93,6 +92,8 @@ in config = lib.mkIf cfg.enable { + programs.gamescope.enable = lib.mkDefault true; + programs.gamescope.capSysNice = lib.mkDefault true; hardware.steam-hardware.enable = lib.mkDefault true; materus.profile.steam.extraEnv = { XDG_DATA_DIRS = "/usr/share:\${XDG_DATA_DIRS}"; @@ -102,6 +103,7 @@ in enable = lib.mkDefault true; dedicatedServer.openFirewall = lib.mkDefault true; remotePlay.openFirewall = lib.mkDefault true; + gamescopeSession.enable = lib.mkDefault true; }; environment.sessionVariables = rec { STEAM_EXTRA_COMPAT_TOOLS_PATHS = lib.mkDefault "\${HOME}/.steam/root/compatibilitytools.d";