diff --git a/flake.nix b/flake.nix index aa78bb6..e9253c2 100644 --- a/flake.nix +++ b/flake.nix @@ -53,6 +53,7 @@ rquickshare = prev.callPackage ./overlays/rquickshare { }; rastertokpsl-re = prev.callPackage ./overlays/rastertokpsl-re { }; usb-sniffer = prev.callPackage ./overlays/usb-sniffer { }; + gamma-launcher = prev.callPackage ./overlays/gamma-launcher { }; wireshark = prev.wireshark.overrideAttrs ( finalAttrs: prevAttrs: { postInstall = prevAttrs.postInstall + '' diff --git a/hosts/shark/home.nix b/hosts/shark/home.nix index 22c05fa..3b8db11 100755 --- a/hosts/shark/home.nix +++ b/hosts/shark/home.nix @@ -14,6 +14,7 @@ blueman kdePackages.okular bitbox + gamma-launcher ]; }; systemd.user.services = { diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index 0bc75e6..071bf12 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -19,6 +19,7 @@ ./hardware/amdgpu.nix ./hardware/cc1.nix ./hardware/fv43u.nix + ./hardware/pimax.nix ./hardware/q3279vwf.nix ./hardware/virtual-camera.nix diff --git a/modules/nixos/hardware/fv43u.nix b/modules/nixos/hardware/fv43u.nix index 77bb100..1f66a3a 100644 --- a/modules/nixos/hardware/fv43u.nix +++ b/modules/nixos/hardware/fv43u.nix @@ -15,7 +15,7 @@ in enable = mkEnableOption "Enable optimisations for the Gigabyte FV43U monitor"; hdr = mkOption { type = types.bool; - default = true; + default = false; description = "Enable HDR support for the Gigabyte FV43U monitor."; }; }; @@ -64,9 +64,9 @@ in scale = 1; bitdepth = 10; addreserved = "340,0,0,0"; - cm = if cfg.hdr then "hdr" else "srgb"; + cm = if cfg.hdr then "hdredid" else "srgb"; sdr_min_luminance = 0.25; - sdr_max_luminance = 400; + sdr_max_luminance = 250; }; xwayland.force_zero_scaling = true; misc.vrr = 2; # VA suffers from VRR flicker diff --git a/modules/nixos/hardware/pimax.nix b/modules/nixos/hardware/pimax.nix new file mode 100644 index 0000000..c08cafe --- /dev/null +++ b/modules/nixos/hardware/pimax.nix @@ -0,0 +1,92 @@ +{ + pkgs, + lib, + config, + username, + ... +}: +with lib; + +let + cfg = config.hardware.pimax; +in +{ + options.hardware.pimax = { + enable = mkEnableOption ""; + }; + + config = mkIf cfg.enable ( + let + monado-pimax = + # https://gitlab.freedesktop.org/Coreforge/monado/-/commits/pimax?ref_type=heads + pkgs.monado.overrideAttrs { + pname = "monado-pimax"; + patches = [ ]; + src = pkgs.fetchFromGitLab { + domain = "gitlab.freedesktop.org"; + owner = "Coreforge"; + repo = "monado"; + rev = "f858ee5dd8ca7696bd9219e8278f2671df56fe6e"; + hash = "sha256-Si56yvG+oSfyUaPAlF1FgB7WJo8td1xuVxYnkJvbu4o="; + }; + }; + monado-pimax-new = + # https://gitlab.freedesktop.org/Coreforge/monado/-/commits/pimax?ref_type=heads + pkgs.monado.overrideAttrs { + pname = "monado-pimax"; + patches = [ ]; + src = pkgs.fetchFromGitLab { + domain = "gitlab.freedesktop.org"; + owner = "Coreforge"; + repo = "monado"; + rev = "f712f680dd57753a31d2605ae1505b06f30d50eb"; + hash = "sha256-ke7UXimIvPBDvBU7RV7Q8fAum5LYnHC64NLA7x3XftU="; + }; + }; + in + { + environment.systemPackages = with pkgs; [ + opencomposite + ]; + + home-manager.users."${username}".xdg.configFile = { + "openxr/1/active_runtime.json".source = "${monado-pimax}/share/openxr/1/openxr_monado.json"; + "openvr/openvrpaths.vrpath".text = builtins.toJSON { + config = [ "~/.local/share/Steam/config" ]; + external_drivers = null; + jsonid = "vrpathreg"; + log = [ "~/.local/share/Steam/logs" ]; + runtime = [ "${pkgs.opencomposite}/lib/opencomposite" ]; + version = 1; + }; + }; + + boot.kernelPatches = [ + { + name = "pimax-quirks"; + patch = ./pimax.patch; + } + { + name = "amdgpu-ignore-ctx-privileges"; + patch = 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="; + }; + } + ]; + + services.monado = { + enable = true; + defaultRuntime = true; + highPriority = true; + package = monado-pimax; + }; + + systemd.user.services.monado.environment = { + STEAMVR_LH_ENABLE = "1"; + XRT_COMPOSITOR_COMPUTE = "1"; + }; + } + ); +} diff --git a/modules/nixos/hardware/pimax.patch b/modules/nixos/hardware/pimax.patch new file mode 100644 index 0000000..f43e0dc --- /dev/null +++ b/modules/nixos/hardware/pimax.patch @@ -0,0 +1,31 @@ +From 13da539f1115fe9803ea5570be0d9ec5310e404c Mon Sep 17 00:00:00 2001 +From: Sefa Eyeoglu +Date: Mon, 20 May 2024 18:28:39 +0200 +Subject: [PATCH] drm/edid: add non-desktop quirk to Pimax VR headsets + +Signed-off-by: Sefa Eyeoglu +--- + drivers/gpu/drm/drm_edid.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c +index 0f7c4c5b14b9..87ca0637732b 100644 +--- a/drivers/gpu/drm/drm_edid.c ++++ b/drivers/gpu/drm/drm_edid.c +@@ -237,6 +237,13 @@ static const struct edid_quirk { + EDID_QUIRK('S', 'E', 'C', 0x144a, EDID_QUIRK_NON_DESKTOP), + EDID_QUIRK('A', 'U', 'S', 0xc102, EDID_QUIRK_NON_DESKTOP), + ++ /* Pimax VR Headsets */ ++ EDID_QUIRK('O', 'V', 'R', 0x0003, EDID_QUIRK_NON_DESKTOP), ++ EDID_QUIRK('S', 'V', 'R', 0x1019, EDID_QUIRK_NON_DESKTOP), ++ EDID_QUIRK('P', 'V', 'R', 0x1019, EDID_QUIRK_NON_DESKTOP), ++ EDID_QUIRK('P', 'V', 'R', 0x101a, EDID_QUIRK_NON_DESKTOP), ++ EDID_QUIRK('P', 'V', 'R', 0x101b, EDID_QUIRK_NON_DESKTOP), ++ + /* Sony PlayStation VR Headset */ + EDID_QUIRK('S', 'N', 'Y', 0x0704, EDID_QUIRK_NON_DESKTOP), + +-- +2.44.0 + diff --git a/modules/nixos/usecases/gaming.nix b/modules/nixos/usecases/gaming.nix index b4b989f..b133aa0 100644 --- a/modules/nixos/usecases/gaming.nix +++ b/modules/nixos/usecases/gaming.nix @@ -39,7 +39,6 @@ in }) rpcs3 bottles - wineWowPackages.stagingFull wineWow64Packages.stagingFull winetricks protontricks diff --git a/overlays/gamma-launcher/default.nix b/overlays/gamma-launcher/default.nix new file mode 100644 index 0000000..a5a8ff8 --- /dev/null +++ b/overlays/gamma-launcher/default.nix @@ -0,0 +1,67 @@ +{ + lib, + python3Packages, + fetchFromGitHub, + unrar, +}: +python3Packages.buildPythonApplication rec { + pname = "gamma-launcher"; + version = "2.5"; + + src = fetchFromGitHub { + owner = "Mord3rca"; + repo = "gamma-launcher"; + rev = "v${version}"; + hash = "sha256-qzjfgDFimEL6vtsJBubY6fHsokilDB248WwHJt3F7fI="; + }; + + pyproject = true; + + buildInputs = [ python3Packages.setuptools ]; + + propagatedBuildInputs = with python3Packages; [ + beautifulsoup4 + cloudscraper + gitpython + platformdirs + py7zr + unrardll + requests + tenacity + tqdm + (python3Packages.buildPythonPackage rec { + pname = "python-unrar"; + version = "0.4"; + + format = "setuptools"; + + src = fetchFromGitHub { + owner = "matiasb"; + repo = "python-unrar"; + rev = "v${version}"; + hash = "sha256-JeuMDwKltpp2i7rkGiQ5yAOIEtiUdfhOJGDVAGGib+A="; + }; + + patchPhase = '' + substituteInPlace unrar/unrarlib.py \ + --replace-fail "os.environ.get('UNRAR_LIB_PATH', None)" "r'${unrar}/lib/libunrar.so'" + ''; + + pythonImportsCheck = [ "unrar" ]; + + meta = with lib; { + description = "Work with RAR archive files through unrar library using ctypes"; + homepage = "https://github.com/matiasb/python-unrar"; + license = licenses.gpl3; + maintainers = with maintainers; [ theaninova ]; + }; + }) + ]; + + meta = with lib; { + description = "This is a reimplementation of G.A.M.M.A. launcher used for the first setup"; + homepage = "https://github.com/Mord3rca/gamma-launcher"; + license = licenses.gpl3; + maintainers = with maintainers; [ theaninova ]; + }; +}