some vr stuff

This commit is contained in:
Kopatz
2025-06-29 19:18:47 +02:00
parent df27b2f789
commit d10fed2673
4 changed files with 109 additions and 5 deletions

22
home-manager/vr.nix Normal file
View File

@@ -0,0 +1,22 @@
{ pkgs, config, ... }:
{
#xdg.configFile."openvr/openvrpaths.vrpath".text = ''
# {
# "config" :
# [
# "~/.local/share/Steam/config"
# ],
# "external_drivers" : null,
# "jsonid" : "vrpathreg",
# "log" :
# [
# "~/.local/share/Steam/logs"
# ],
# "runtime" :
# [
# "${pkgs.opencomposite}/lib/opencomposite"
# ],
# "version" : 1
# }
#'';
}

80
modules/hardware/vr.nix Normal file
View File

@@ -0,0 +1,80 @@
{ pkgs, config, ... }:
let
# https://wiki.nixos.org/wiki/VR#Patching_AMDGPU_to_allow_high_priority_queues
amdgpu =
{ pkgs
, lib
, kernel ? pkgs.linuxPackages_latest.kernel
}:
pkgs.stdenv.mkDerivation {
pname = "amdgpu-kernel-module";
inherit (kernel) src version postPatch nativeBuildInputs;
kernel_dev = kernel.dev;
kernelVersion = kernel.modDirVersion;
modulePath = "drivers/gpu/drm/amd/amdgpu";
buildPhase = ''
BUILT_KERNEL=$kernel_dev/lib/modules/$kernelVersion/build
cp $BUILT_KERNEL/Module.symvers .
cp $BUILT_KERNEL/.config .
cp $kernel_dev/vmlinux .
make "-j$NIX_BUILD_CORES" modules_prepare
make "-j$NIX_BUILD_CORES" M=$modulePath modules
'';
installPhase = ''
make \
INSTALL_MOD_PATH="$out" \
XZ="xz -T$NIX_BUILD_CORES" \
M="$modulePath" \
modules_install
'';
meta = {
description = "AMD GPU kernel module";
license = lib.licenses.gpl3;
};
};
amdgpu-kernel-module = pkgs.callPackage amdgpu {
# Make sure the module targets the same kernel as your system is using.
kernel = config.boot.kernelPackages.kernel;
};
in
{
#programs.envision = {
# enable = true;
# openFirewall = true;
#};
#services.monado = {
# enable = true;
# defaultRuntime = true; # Register as default OpenXR runtime
#};
#environment.systemPackages = with pkgs; [
# monado
#];
#systemd.user.services.monado.environment = {
# STEAMVR_LH_ENABLE = "1";
# XRT_COMPOSITOR_COMPUTE = "1";
#};
# programs.git = {
# enable = true;
# lfs.enable = true;
# };
hardware.steam-hardware.enable = true;
boot.extraModulePackages = [
(amdgpu-kernel-module.overrideAttrs (_: {
patches = [
(pkgs.fetchpatch {
name = "cap_sys_nice_begone.patch";
url = "https://github.com/Frogging-Family/community-patches/raw/master/linux61-tkg/cap_sys_nice_begone.mypatch";
hash = "sha256-Y3a0+x2xvHsfLax/uwycdJf3xLxvVfkfDVqjkxNaYEo=";
})
];
}))
];
}

View File

@@ -18,6 +18,7 @@
../../modules/misc/faster-boot-time.nix ../../modules/misc/faster-boot-time.nix
#../../modules/hardware/ryzenmonitor.nix #../../modules/hardware/ryzenmonitor.nix
../../modules/networkmanager.nix ../../modules/networkmanager.nix
../../modules/hardware/vr.nix
]; ];
custom = { custom = {
@@ -170,11 +171,11 @@
# disable until CVE-2024-47176, CVE-2024-47076, CVE-2024-47175, and CVE-2024-47177 is fixed # disable until CVE-2024-47176, CVE-2024-47076, CVE-2024-47175, and CVE-2024-47177 is fixed
services.printing.enable = false; services.printing.enable = false;
services.printing.drivers = [ pkgs.brlaser ]; services.printing.drivers = [ pkgs.brlaser ];
services.avahi = { #services.avahi = {
enable = false; # enable = false;
nssmdns4 = true; # nssmdns4 = true;
openFirewall = true; # openFirewall = true;
}; #};
# Enable automatic login for the user. # Enable automatic login for the user.
#services.xserver.displayManager.autoLogin.enable = true; #services.xserver.displayManager.autoLogin.enable = true;

View File

@@ -32,6 +32,7 @@
../../home-manager/stylix.nix ../../home-manager/stylix.nix
../../home-manager/mpv.nix ../../home-manager/mpv.nix
../../home-manager/discord-theme.nix ../../home-manager/discord-theme.nix
../../home-manager/vr.nix
inputs.nixvim.homeManagerModules.nixvim inputs.nixvim.homeManagerModules.nixvim
]; ];