Commit fd81529

HPCesia <me@hpcesia.com>
2025-11-12 18:23:18
feat: game
1 parent 22c70ff
modules/game/gamemode.nix
@@ -0,0 +1,7 @@
+{
+  flake.modules.nixos.game = _: {
+    programs.gamemode = {
+      enable = true;
+    };
+  };
+}
modules/game/minecraft.nix
@@ -0,0 +1,7 @@
+{
+  flake.modules.homeManager.game = {pkgs, ...}: {
+    home.packages = with pkgs; [
+      prismlauncher
+    ];
+  };
+}
modules/game/pipewire.nix
@@ -0,0 +1,6 @@
+{inputs, ...}: {
+  flake.modules.nixos.game = _: {
+    imports = [inputs.nix-gaming.nixosModules.pipewireLowLatency];
+    services.pipewire.lowLatency.enable = true;
+  };
+}
modules/game/steam.nix
@@ -0,0 +1,24 @@
+{inputs, ...}: {
+  flake.modules.nixos.game = {pkgs, ...}: {
+    imports = [inputs.nix-gaming.nixosModules.platformOptimizations];
+
+    programs.steam = {
+      enable = true;
+      extraCompatPackages = [pkgs.proton-ge-bin];
+      platformOptimizations.enable = true;
+      gamescopeSession.enable = true;
+      protontricks.enable = true;
+      extest.enable = true;
+      remotePlay.openFirewall = true;
+      dedicatedServer.openFirewall = true;
+      fontPackages = [pkgs.wqy_zenhei]; # Need by steam for Chinese
+    };
+  };
+
+  flake.modules.homeManager.game = {pkgs, ...}: {
+    home.packages = with pkgs; [
+      steamcmd
+      steam-tui
+    ];
+  };
+}
modules/users/hpcesia/default.nix
@@ -14,7 +14,8 @@
           "nix-secrets-ssh-hosts"
         ]
         ++ (lib.optionals config.virtualisation.podman.enable ["podman"])
-        ++ (lib.optionals config.virtualisation.docker.enable ["docker"]);
+        ++ (lib.optionals config.virtualisation.docker.enable ["docker"])
+        ++ (lib.optionals config.programs.gamemode.enable ["gamemode"]);
       openssh.authorizedKeys.keys = ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIyxd+nyK9cnULmzXIMhE1/rIB3VMsJ6SuWV4Ha8oE0F hpcesia@kevin"];
     };
 
flake.lock
@@ -208,6 +208,24 @@
       }
     },
     "flake-parts_2": {
+      "inputs": {
+        "nixpkgs-lib": "nixpkgs-lib_2"
+      },
+      "locked": {
+        "lastModified": 1762440070,
+        "narHash": "sha256-xxdepIcb39UJ94+YydGP221rjnpkDZUlykKuF54PsqI=",
+        "owner": "hercules-ci",
+        "repo": "flake-parts",
+        "rev": "26d05891e14c88eb4a5d5bee659c0db5afb609d8",
+        "type": "github"
+      },
+      "original": {
+        "owner": "hercules-ci",
+        "repo": "flake-parts",
+        "type": "github"
+      }
+    },
+    "flake-parts_3": {
       "inputs": {
         "nixpkgs-lib": [
           "nur",
@@ -228,7 +246,7 @@
         "type": "github"
       }
     },
-    "flake-parts_3": {
+    "flake-parts_4": {
       "inputs": {
         "nixpkgs-lib": [
           "stylix",
@@ -249,9 +267,9 @@
         "type": "github"
       }
     },
-    "flake-parts_4": {
+    "flake-parts_5": {
       "inputs": {
-        "nixpkgs-lib": "nixpkgs-lib_2"
+        "nixpkgs-lib": "nixpkgs-lib_3"
       },
       "locked": {
         "lastModified": 1762040540,
@@ -469,6 +487,27 @@
         "type": "github"
       }
     },
+    "nix-gaming": {
+      "inputs": {
+        "flake-parts": "flake-parts_2",
+        "nixpkgs": [
+          "nixpkgs"
+        ]
+      },
+      "locked": {
+        "lastModified": 1762999310,
+        "narHash": "sha256-G1GAqeJPD3ILR2ahmU++r1RscTTpjba/uURYITi6x5c=",
+        "owner": "fufexan",
+        "repo": "nix-gaming",
+        "rev": "4e7b35681a36b19f8dd40b15993869a479da17e4",
+        "type": "github"
+      },
+      "original": {
+        "owner": "fufexan",
+        "repo": "nix-gaming",
+        "type": "github"
+      }
+    },
     "nixos-hardware": {
       "locked": {
         "lastModified": 1762463231,
@@ -548,6 +587,21 @@
         "type": "github"
       }
     },
+    "nixpkgs-lib_3": {
+      "locked": {
+        "lastModified": 1761765539,
+        "narHash": "sha256-b0yj6kfvO8ApcSE+QmA6mUfu8IYG6/uU28OFn4PaC8M=",
+        "owner": "nix-community",
+        "repo": "nixpkgs.lib",
+        "rev": "719359f4562934ae99f5443f20aa06c2ffff91fc",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nix-community",
+        "repo": "nixpkgs.lib",
+        "type": "github"
+      }
+    },
     "nixpkgs-stable": {
       "locked": {
         "lastModified": 1762498405,
@@ -765,7 +819,7 @@
     },
     "nur": {
       "inputs": {
-        "flake-parts": "flake-parts_2",
+        "flake-parts": "flake-parts_3",
         "nixpkgs": "nixpkgs_8"
       },
       "locked": {
@@ -922,6 +976,7 @@
         "home-manager": "home-manager",
         "import-tree": "import-tree",
         "niri-flake": "niri-flake",
+        "nix-gaming": "nix-gaming",
         "nixos-hardware": "nixos-hardware",
         "nixos-logo": "nixos-logo",
         "nixpkgs": "nixpkgs_6",
@@ -1005,7 +1060,7 @@
         "base16-helix": "base16-helix",
         "base16-vim": "base16-vim",
         "firefox-gnome-theme": "firefox-gnome-theme",
-        "flake-parts": "flake-parts_3",
+        "flake-parts": "flake-parts_4",
         "gnome-shell": "gnome-shell",
         "nixpkgs": [
           "nixpkgs"
@@ -1224,7 +1279,7 @@
     "vaultix": {
       "inputs": {
         "crane": "crane",
-        "flake-parts": "flake-parts_4",
+        "flake-parts": "flake-parts_5",
         "nixpkgs": "nixpkgs_11",
         "pre-commit-hooks": "pre-commit-hooks",
         "rust-overlay": "rust-overlay_2"
flake.nix
@@ -19,6 +19,9 @@
 
     niri-flake.url = "github:sodiboo/niri-flake";
 
+    nix-gaming.url = "github:fufexan/nix-gaming";
+    nix-gaming.inputs.nixpkgs.follows = "nixpkgs";
+
     nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
 
     nixos-hardware.url = "github:NixOS/nixos-hardware/master";