From a9235ece232433bb205250518c87e15a65cb70ef Mon Sep 17 00:00:00 2001 From: 514fpv Date: Mon, 10 Jun 2024 17:08:44 +0800 Subject: [PATCH] fix(koumakyou): add gamemode and enable decky --- spec/koumakyou/default.nix | 1 + spec/koumakyou/jovian.nix | 59 +++++++++++++++++++++++++++++++------- 2 files changed, 50 insertions(+), 10 deletions(-) diff --git a/spec/koumakyou/default.nix b/spec/koumakyou/default.nix index 0bba4365..51163f68 100644 --- a/spec/koumakyou/default.nix +++ b/spec/koumakyou/default.nix @@ -43,6 +43,7 @@ programs.regreet.enable = lib.mkForce true; jovian.steam.autoStart = lib.mkForce false; jovian.steam.desktopSession = lib.mkForce "sway"; + jovian.decky-loader.enable = lib.mkForce false; home.plasma.enable = lib.mkForce false; services.greetd.settings.default_session.command = let cfg = config.programs.regreet; diff --git a/spec/koumakyou/jovian.nix b/spec/koumakyou/jovian.nix index 2a20be30..23c95207 100644 --- a/spec/koumakyou/jovian.nix +++ b/spec/koumakyou/jovian.nix @@ -1,4 +1,4 @@ -{ pkgs, jovian, ... }: { +{ pkgs, lib, config, jovian, ... }: { imports = [ jovian.nixosModules.jovian ]; @@ -17,11 +17,13 @@ }; users.home.persistApp.directories = [ - ".steam" ".local/share/Steam" ".config/gamescope" + ".steam" ".local/share/Steam" + ".config/gamescope" ".config/hhd" ".kodi" ]; - users.users.app.extraGroups = [ "networkmanager" ]; + users.users.app.extraGroups = [ "networkmanager" "gamemode" ]; + programs.gamemode.enable = true; programs.regreet.enable = false; home.plasma.enable = true; home.plasma.extraConfig = { @@ -41,11 +43,48 @@ jellycon ])) ]; -} // { - #users.users.decky.uid = 514; - #users.groups.decky.gid = 514; - #jovian.decky-loader = { - # enable = true; - # stateDir = "/nix/persist/decky"; - #}; + + services.handheld-daemon = { + enable = true; + user = "app"; + }; + + jovian.decky-loader = let + adjustor = pkgs.python3.pkgs.buildPythonApplication rec { + pname = "adjustor"; + version = "2.1.5"; + pyproject = true; + + src = pkgs.fetchFromGitHub { + owner = "hhd-dev"; + repo = pname; + rev = "v${version}"; + hash = "sha256-KgeK2lC3b9VbjYmy7rD/ImODWDDx3pWIzWgNnSLJeDs="; + }; + + propagatedBuildInputs = with pkgs.python3.pkgs; [ + setuptools + pyroute2 + rich + ]; + + # This package doesn't have upstream tests. + doCheck = false; + }; + in { + # ~/.steam/steam/.cef-enable-remote-debugging + enable = true; + user = "app"; + extraPackages = with pkgs; [ + curl unzip util-linux gnugrep procps pciutils kmod + ryzenadj # adjustor + ]; + extraPythonPackages = pythonPackages: with pythonPackages; [ + hid pyyaml + # adjustor + ]; + stateDir = "/nix/persist/decky"; + }; + + boot.kernelParams = lib.mkIf config.jovian.decky-loader.enable [ "iomem=relaxed" "amd_pstate=passive" ]; }