about summary refs log tree commit diff
path: root/modules/nixos/games
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2024-03-31 21:29:27 +0300
committerAzat Bahawi <azat@bahawi.net>2024-03-31 21:29:27 +0300
commit9a5427e3a0c0ccf2a82dc503149a26b23fbd6004 (patch)
treef28beec29deeea36038615a8fb98a810891940b5 /modules/nixos/games
parent2024-03-19 (diff)
2024-03-31
Diffstat (limited to 'modules/nixos/games')
-rw-r--r--modules/nixos/games/default.nix15
-rw-r--r--modules/nixos/games/gamemode.nix19
-rw-r--r--modules/nixos/games/lutris.nix6
-rw-r--r--modules/nixos/games/mangohud.nix12
-rw-r--r--modules/nixos/games/minecraft.nix20
-rw-r--r--modules/nixos/games/steam-run.nix78
-rw-r--r--modules/nixos/games/steam.nix16
7 files changed, 88 insertions, 78 deletions
diff --git a/modules/nixos/games/default.nix b/modules/nixos/games/default.nix
index 78aae62..585164e 100644
--- a/modules/nixos/games/default.nix
+++ b/modules/nixos/games/default.nix
@@ -1,11 +1,9 @@
-{
-  config,
-  lib,
-  ...
-}:
-with lib; let
+{ config, lib, ... }:
+with lib;
+let
   cfg = config.nixfiles.modules.games;
-in {
+in
+{
   imports = [
     ./gamemode.nix
     ./lutris.nix
@@ -15,8 +13,7 @@ in {
     ./steam.nix
   ];
 
-  options.nixfiles.modules.games.enable32BitSupport =
-    mkEnableOption "support for games";
+  options.nixfiles.modules.games.enable32BitSupport = mkEnableOption "support for games";
 
   config = mkIf cfg.enable32BitSupport {
     services = {
diff --git a/modules/nixos/games/gamemode.nix b/modules/nixos/games/gamemode.nix
index 193a764..eb485f8 100644
--- a/modules/nixos/games/gamemode.nix
+++ b/modules/nixos/games/gamemode.nix
@@ -1,18 +1,13 @@
-{
-  config,
-  lib,
-  ...
-}:
-with lib; let
+{ config, lib, ... }:
+with lib;
+let
   cfg = config.nixfiles.modules.games.gamemode;
-in {
-  options.nixfiles.modules.games.gamemode.enable =
-    mkEnableOption "Feral GameMode";
+in
+{
+  options.nixfiles.modules.games.gamemode.enable = mkEnableOption "Feral GameMode";
 
   config = mkIf cfg.enable {
-    hm.xdg.configFile."gamemode.ini".text = generators.toINI {} {
-      general.softrealtime = "auto";
-    };
+    hm.xdg.configFile."gamemode.ini".text = generators.toINI { } { general.softrealtime = "auto"; };
 
     programs.gamemode.enable = true;
   };
diff --git a/modules/nixos/games/lutris.nix b/modules/nixos/games/lutris.nix
index f130be3..62fe521 100644
--- a/modules/nixos/games/lutris.nix
+++ b/modules/nixos/games/lutris.nix
@@ -4,9 +4,11 @@
   pkgs,
   ...
 }:
-with lib; let
+with lib;
+let
   cfg = config.nixfiles.modules.games.lutris;
-in {
+in
+{
   options.nixfiles.modules.games.lutris.enable = mkEnableOption "Lutris";
 
   config = mkIf cfg.enable {
diff --git a/modules/nixos/games/mangohud.nix b/modules/nixos/games/mangohud.nix
index 509e035..955f50c 100644
--- a/modules/nixos/games/mangohud.nix
+++ b/modules/nixos/games/mangohud.nix
@@ -1,11 +1,9 @@
-{
-  config,
-  lib,
-  ...
-}:
-with lib; let
+{ config, lib, ... }:
+with lib;
+let
   cfg = config.nixfiles.modules.games.mangohud;
-in {
+in
+{
   options.nixfiles.modules.games.mangohud.enable = mkEnableOption "MangoHud";
 
   config = mkIf cfg.enable {
diff --git a/modules/nixos/games/minecraft.nix b/modules/nixos/games/minecraft.nix
index 8a1a0b5..6e163dc 100644
--- a/modules/nixos/games/minecraft.nix
+++ b/modules/nixos/games/minecraft.nix
@@ -5,10 +5,12 @@
   pkgs,
   ...
 }:
-with lib; let
+with lib;
+let
   cfg = config.nixfiles.modules.games.minecraft;
-in {
-  imports = [inputs.minecraft.nixosModules.minecraft-servers];
+in
+{
+  imports = [ inputs.minecraft.nixosModules.minecraft-servers ];
 
   options.nixfiles.modules.games.minecraft = {
     client.enable = mkEnableOption "Minecraft client";
@@ -30,13 +32,11 @@ in {
   };
 
   config = mkMerge [
-    (mkIf cfg.client.enable {
-      hm.home.packages = [pkgs.prismlauncher];
-    })
+    (mkIf cfg.client.enable { hm.home.packages = [ pkgs.prismlauncher ]; })
     (mkIf cfg.server.enable {
-      nixfiles.modules.common.nix.allowedUnfreePackages = ["minecraft-server"];
+      nixfiles.modules.common.nix.allowedUnfreePackages = [ "minecraft-server" ];
 
-      ark.directories = [config.services.minecraft-servers.dataDir];
+      ark.directories = [ config.services.minecraft-servers.dataDir ];
 
       services.minecraft-servers = {
         enable = true;
@@ -78,9 +78,9 @@ in {
         };
       };
 
-      nixpkgs.overlays = [inputs.minecraft.overlay];
+      nixpkgs.overlays = [ inputs.minecraft.overlay ];
 
-      my.extraGroups = [config.services.minecraft-servers.group];
+      my.extraGroups = [ config.services.minecraft-servers.group ];
     })
   ];
 }
diff --git a/modules/nixos/games/steam-run.nix b/modules/nixos/games/steam-run.nix
index fc51c85..cfee8ae 100644
--- a/modules/nixos/games/steam-run.nix
+++ b/modules/nixos/games/steam-run.nix
@@ -4,9 +4,11 @@
   pkgs,
   ...
 }:
-with lib; let
+with lib;
+let
   cfg = config.nixfiles.modules.games.steam-run;
-in {
+in
+{
   options.nixfiles.modules.games.steam-run = {
     enable = mkEnableOption "native Steam runtime";
 
@@ -19,7 +21,10 @@ in {
 
   config = mkIf cfg.enable {
     nixfiles.modules = {
-      common.nix.allowedUnfreePackages = ["steam" "steam-run"];
+      common.nix.allowedUnfreePackages = [
+        "steam"
+        "steam-run"
+      ];
 
       games = {
         enable32BitSupport = true;
@@ -30,46 +35,55 @@ in {
 
     hm.home.packages = with pkgs; [
       (steam.override {
-        extraLibraries = _:
+        extraLibraries =
+          _:
           with cfg.quirks;
-            optional blackIsleStudios openssl_1_0_0
-            ++ optionals cryptOfTheNecrodancer [
-              (import (builtins.fetchTarball {
-                url = "https://github.com/NixOS/nixpkgs/archive/d1c3fea7ecbed758168787fe4e4a3157e52bc808.tar.gz";
-                sha256 = "0ykm15a690v8lcqf2j899za3j6hak1rm3xixdxsx33nz7n3swsyy";
-              }) {inherit (config.nixpkgs) config localSystem;})
-              .flac
-            ]
-            ++ optionals mountAndBladeWarband [
-              (glew.overrideAttrs (_: super: let
+          optional blackIsleStudios openssl_1_0_0
+          ++ optionals cryptOfTheNecrodancer [
+            (import (builtins.fetchTarball {
+              url = "https://github.com/NixOS/nixpkgs/archive/d1c3fea7ecbed758168787fe4e4a3157e52bc808.tar.gz";
+              sha256 = "0ykm15a690v8lcqf2j899za3j6hak1rm3xixdxsx33nz7n3swsyy";
+            }) { inherit (config.nixpkgs) config localSystem; }).flac
+          ]
+          ++ optionals mountAndBladeWarband [
+            (glew.overrideAttrs (
+              _: super:
+              let
                 opname = super.pname;
-              in rec {
+              in
+              rec {
                 pname = "${opname}-steam-run-fix";
                 inherit (super) version;
                 src = fetchurl {
                   url = "mirror://sourceforge/${opname}/${opname}-${version}.tgz";
                   hash = "sha256-BN6R5+Z2MDm8EZQAlc2cf4gLq6ghlqd2X3J6wFqZPJU=";
                 };
-              }))
-              (fmodex.overrideAttrs (_: super: let
+              }
+            ))
+            (fmodex.overrideAttrs (
+              _: super:
+              let
                 opname = super.pname;
-              in rec {
+              in
+              rec {
                 pname = "${opname}-steam-run-fix";
                 inherit (super) version;
-                installPhase = let
-                  libPath = makeLibraryPath [
-                    alsa-lib
-                    libpulseaudio
-                    stdenv.cc.cc
-                  ];
-                in ''
-                  install -Dm755 api/lib/libfmodex64-${version}.so $out/lib/libfmodex64.so
-                  patchelf --set-rpath ${libPath} $out/lib/libfmodex64.so
-                '';
-              }))
-            ];
-      })
-      .run
+                installPhase =
+                  let
+                    libPath = makeLibraryPath [
+                      alsa-lib
+                      libpulseaudio
+                      stdenv.cc.cc
+                    ];
+                  in
+                  ''
+                    install -Dm755 api/lib/libfmodex64-${version}.so $out/lib/libfmodex64.so
+                    patchelf --set-rpath ${libPath} $out/lib/libfmodex64.so
+                  '';
+              }
+            ))
+          ];
+      }).run
     ];
   };
 }
diff --git a/modules/nixos/games/steam.nix b/modules/nixos/games/steam.nix
index 7262d7f..5883b0e 100644
--- a/modules/nixos/games/steam.nix
+++ b/modules/nixos/games/steam.nix
@@ -4,15 +4,19 @@
   pkgs,
   ...
 }:
-with lib; let
+with lib;
+let
   cfg = config.nixfiles.modules.games.steam;
-in {
-  options.nixfiles.modules.games.steam.enable =
-    mkEnableOption "Steam runtime";
+in
+{
+  options.nixfiles.modules.games.steam.enable = mkEnableOption "Steam runtime";
 
   config = mkIf cfg.enable {
     nixfiles.modules = {
-      common.nix.allowedUnfreePackages = ["steam" "steam-original"];
+      common.nix.allowedUnfreePackages = [
+        "steam"
+        "steam-original"
+      ];
 
       games = {
         enable32BitSupport = true;
@@ -22,7 +26,7 @@ in {
     };
 
     hm.home.packages = with pkgs; [
-      (steam.override {extraEnv.MANGOHUD = 1;})
+      (steam.override { extraEnv.MANGOHUD = 1; })
       protontricks
     ];
   };

Consider giving Nix/NixOS a try! <3