From 9849e6d22b35265c96f4bdd9f45dfe11eb9d9dde Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Sun, 20 Oct 2024 02:08:04 -0400 Subject: [PATCH] cleanup --- etcnixos/common.nix | 7 ++- etcnixos/no-rgb.nix | 33 ++++++++++++++ etcnixos/system-mreow.nix | 1 - etcnixos/system-nixos.nix | 96 ++------------------------------------- etcnixos/vr.nix | 35 ++++++++++++++ 5 files changed, 79 insertions(+), 93 deletions(-) create mode 100644 etcnixos/no-rgb.nix create mode 100644 etcnixos/vr.nix diff --git a/etcnixos/common.nix b/etcnixos/common.nix index 82cc7bf..8d70714 100644 --- a/etcnixos/common.nix +++ b/etcnixos/common.nix @@ -9,7 +9,12 @@ ... }: { - imports = [ ./declarative-nm.nix ]; + imports = [ + ./declarative-nm.nix + + inputs.nixos-hardware.nixosModules.common-pc-ssd + + ]; nix = { #garbage collection and cleanup stuff diff --git a/etcnixos/no-rgb.nix b/etcnixos/no-rgb.nix new file mode 100644 index 0000000..e3368f2 --- /dev/null +++ b/etcnixos/no-rgb.nix @@ -0,0 +1,33 @@ +{ pkgs, ... }: +{ + systemd.services.no-rgb = + let + no-rgb = pkgs.writeScriptBin "no-rgb" '' + #!/bin/sh + set -e + + NUM_DEVICES=$(${pkgs.openrgb}/bin/openrgb --noautoconnect --list-devices | ${pkgs.gnugrep}/bin/grep -E '^[0-9]+: ' | ${pkgs.coreutils}/bin/wc -l) + + for i in $(${pkgs.coreutils}/bin/seq 0 $(($NUM_DEVICES - 1))); do + ${pkgs.openrgb}/bin/openrgb --noautoconnect --device $i --mode direct --color 000000 + done + ''; + in + { + description = "disable rgb"; + serviceConfig = { + ExecStart = "${no-rgb}/bin/no-rgb"; + Type = "oneshot"; + }; + wantedBy = [ "multi-user.target" ]; + }; + + services.hardware.openrgb.enable = true; + services.udev.packages = [ pkgs.openrgb ]; + hardware.i2c.enable = true; + + environment.systemPackages = with pkgs; [ + openrgb-with-all-plugins + ]; + +} diff --git a/etcnixos/system-mreow.nix b/etcnixos/system-mreow.nix index efa9508..0f102c8 100644 --- a/etcnixos/system-mreow.nix +++ b/etcnixos/system-mreow.nix @@ -3,7 +3,6 @@ pkgs, lib, username, - system, inputs, ... }: diff --git a/etcnixos/system-nixos.nix b/etcnixos/system-nixos.nix index 171c3ef..bebf5c7 100644 --- a/etcnixos/system-nixos.nix +++ b/etcnixos/system-nixos.nix @@ -3,8 +3,6 @@ pkgs, lib, username, - system, - cpu_arch, inputs, ... }: @@ -12,27 +10,17 @@ imports = [ ./common.nix ./hardware_desktop.nix + ./no-rgb.nix + ./vr.nix inputs.nixos-hardware.nixosModules.common-cpu-amd-pstate inputs.nixos-hardware.nixosModules.common-cpu-amd-zenpower - inputs.nixos-hardware.nixosModules.common-pc-ssd ]; boot = { # kernelPackages = lib.mkForce pkgs.linuxPackages_6_10; # supportedFilesystems = [ "zfs" ]; - kernelPatches = [ - # for making ALVR support better :) - { - 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"; - sha256 = "Y3a0+x2xvHsfLax/uwycdJf3xLxvVfkfDVqjkxNaYEo="; - }; - } - ]; kernelParams = [ # allow overclocking (I actually underclock but lol) "amdgpu.ppfeaturemask=0xFFF7FFFF" @@ -68,87 +56,13 @@ }; }; - systemd.services.no-rgb = - let - no-rgb = pkgs.writeScriptBin "no-rgb" '' - #!/bin/sh - set -e - - NUM_DEVICES=$(${pkgs.openrgb}/bin/openrgb --noautoconnect --list-devices | ${pkgs.gnugrep}/bin/grep -E '^[0-9]+: ' | ${pkgs.coreutils}/bin/wc -l) - - for i in $(${pkgs.coreutils}/bin/seq 0 $(($NUM_DEVICES - 1))); do - ${pkgs.openrgb}/bin/openrgb --noautoconnect --device $i --mode direct --color 000000 - done - ''; - in - { - description = "disable rgb"; - serviceConfig = { - ExecStart = "${no-rgb}/bin/no-rgb"; - Type = "oneshot"; - }; - wantedBy = [ "multi-user.target" ]; - }; - - services.hardware.openrgb.enable = true; - services.udev.packages = [ pkgs.openrgb ]; - hardware.i2c.enable = true; - - # System packages - environment.systemPackages = with pkgs; [ - openrgb-with-all-plugins - lact - ]; - - services.wivrn = { - enable = true; - openFirewall = true; - package = inputs.wivrn.legacyPackages.${pkgs.system}.wivrn; - defaultRuntime = true; - autoStart = true; - config = { - enable = true; - json = { - scale = 1.0; - bitrate = 100000000; - encoders = [ - { - encoder = "vaapi"; - codec = "h265"; - width = 1.0; - height = 1.0; - offset_x = 0.0; - offset_y = 0.0; - } - ]; - }; - }; - }; - programs.steam = { remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play }; - # services.ollama = { - # enable = true; - # acceleration = "rocm"; - # environmentVariables = { - # HCC_AMDGPU_TARGET = "gfx1031"; # used to be necessary, but doesn't seem to anymore - # }; - # rocmOverrideGfx = "10.3.1"; - # }; - - # services.open-webui = { - # enable = true; - # openFirewall = true; - # port = 8082; - # environment = { - # # Disable authentication - # WEBUI_AUTH = "False"; - # PYDANTIC_SKIP_VALIDATING_CORE_SCHEMAS = "True"; - # }; - # }; - + environment.systemPackages = with pkgs; [ + lact + ]; systemd.packages = with pkgs; [ lact ]; systemd.services.lactd.wantedBy = [ "multi-user.target" ]; diff --git a/etcnixos/vr.nix b/etcnixos/vr.nix new file mode 100644 index 0000000..70bb4b5 --- /dev/null +++ b/etcnixos/vr.nix @@ -0,0 +1,35 @@ +{ pkgs, inputs, ... }: +{ + services.wivrn = { + enable = true; + openFirewall = true; + + # Use my fork for WiVRn 0.20 + package = inputs.wivrn.legacyPackages.${pkgs.system}.wivrn; + + # Executing it through the systemd service executes WiVRn w/ CAP_SYS_NICE + # Resulting in no stutters! + defaultRuntime = true; + autoStart = true; + + # Config for WiVRn + config = { + enable = true; + json = { + scale = 1.0; + # 100 Mb/s + bitrate = 100000000; + encoders = [ + { + encoder = "vaapi"; + codec = "h265"; + width = 1.0; + height = 1.0; + offset_x = 0.0; + offset_y = 0.0; + } + ]; + }; + }; + }; +}