diff options
author | Azat Bahawi <azat@bahawi.net> | 2022-08-12 22:53:53 +0300 |
---|---|---|
committer | Azat Bahawi <azat@bahawi.net> | 2022-08-12 22:53:53 +0300 |
commit | 61b94f0dd06cac0f7dcd38cce80f2a7ab8376098 (patch) | |
tree | b703a9fe11eae6c4cae4e4682f02caf0caa171d0 /modules/nixfiles/games |
2022-08-12
Diffstat (limited to 'modules/nixfiles/games')
-rw-r--r-- | modules/nixfiles/games/default.nix | 47 | ||||
-rw-r--r-- | modules/nixfiles/games/gamemode.nix | 13 | ||||
-rw-r--r-- | modules/nixfiles/games/gog.nix | 19 | ||||
-rw-r--r-- | modules/nixfiles/games/lutris.nix | 37 | ||||
-rw-r--r-- | modules/nixfiles/games/mangohud.nix | 13 | ||||
-rw-r--r-- | modules/nixfiles/games/minecraft.nix | 15 | ||||
-rw-r--r-- | modules/nixfiles/games/steam-run.nix | 59 | ||||
-rw-r--r-- | modules/nixfiles/games/steam.nix | 21 |
8 files changed, 224 insertions, 0 deletions
diff --git a/modules/nixfiles/games/default.nix b/modules/nixfiles/games/default.nix new file mode 100644 index 0000000..532fc57 --- /dev/null +++ b/modules/nixfiles/games/default.nix @@ -0,0 +1,47 @@ +{ + config, + lib, + ... +}: +with lib; let + cfg = config.nixfiles.modules.games; +in { + imports = [ + ./gamemode.nix + ./gog.nix + ./lutris.nix + ./mangohud.nix + ./minecraft.nix + ./steam-run.nix + ./steam.nix + ]; + + options.nixfiles.modules.games.enable32BitSupport = + mkEnableOption "Whether to enable support for games."; + + config = mkIf cfg.enable32BitSupport { + services = { + jack.alsa.support32Bit = config.services.jack.alsa.enable; + + pipewire.alsa.support32Bit = config.services.pipewire.alsa.enable; + + xserver.inputClassSections = [ + '' + Identifier "ds-touchpad" + Driver "libinput" + MatchProduct "Wireless Controller Touchpad" + Option "Ignore" "true" + '' + ]; + }; + + hardware = { + opengl = mkIf config.hardware.opengl.enable { + extraPackages32 = config.hardware.opengl.extraPackages; + driSupport32Bit = config.hardware.opengl.driSupport; + }; + + pulseaudio.support32Bit = config.hardware.pulseaudio.enable; + }; + }; +} diff --git a/modules/nixfiles/games/gamemode.nix b/modules/nixfiles/games/gamemode.nix new file mode 100644 index 0000000..a74b651 --- /dev/null +++ b/modules/nixfiles/games/gamemode.nix @@ -0,0 +1,13 @@ +{ + config, + lib, + ... +}: +with lib; let + cfg = config.nixfiles.modules.games.gamemode; +in { + options.nixfiles.modules.games.gamemode.enable = + mkEnableOption "Whether to enable GameMode."; + + config = mkIf cfg.enable {programs.gamemode.enable = true;}; +} diff --git a/modules/nixfiles/games/gog.nix b/modules/nixfiles/games/gog.nix new file mode 100644 index 0000000..f1188a2 --- /dev/null +++ b/modules/nixfiles/games/gog.nix @@ -0,0 +1,19 @@ +{ + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.nixfiles.modules.games.gog; +in { + options.nixfiles.modules.games.gog.enable = + mkEnableOption + "Whether to enable GOG clients and the ability to run GOG games."; + + config = mkIf cfg.enable { + nixfiles.modules.games.steam-run.enable = true; + + hm.home.packages = with pkgs; [lgogdownloader]; + }; +} diff --git a/modules/nixfiles/games/lutris.nix b/modules/nixfiles/games/lutris.nix new file mode 100644 index 0000000..ec1eaa2 --- /dev/null +++ b/modules/nixfiles/games/lutris.nix @@ -0,0 +1,37 @@ +{ + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.nixfiles.modules.games.lutris; +in { + options.nixfiles.modules.games.lutris.enable = + mkEnableOption "Whether to enable Lutris."; + + config = mkIf cfg.enable { + nixfiles.modules.games = { + steam-run.enable = true; + gamemode.enable = true; + }; + + hm.home.packages = with pkgs; [ + (lutris.override { + lutris-unwrapped = lutris-unwrapped.override { + wine = buildFHSUserEnv { + # We don't really need Wine because Lutris downloads required + # runtime files for us. This feature is more robust because you can + # juggle different versions without manually rebuilding anything + # because nixpkgs cache was pruned. + name = "empty"; + }; + }; + steamSupport = false; + extraPkgs = _: [ + driversi686Linux.mesa # Battle.net + ]; + }) + ]; + }; +} diff --git a/modules/nixfiles/games/mangohud.nix b/modules/nixfiles/games/mangohud.nix new file mode 100644 index 0000000..21d5fd1 --- /dev/null +++ b/modules/nixfiles/games/mangohud.nix @@ -0,0 +1,13 @@ +{ + config, + lib, + ... +}: +with lib; let + cfg = config.nixfiles.modules.games.mangohud; +in { + options.nixfiles.modules.games.mangohud.enable = + mkEnableOption "Whether to enable MangoHud."; + + config = mkIf cfg.enable {hm.programs.mangohud.enable = true;}; +} diff --git a/modules/nixfiles/games/minecraft.nix b/modules/nixfiles/games/minecraft.nix new file mode 100644 index 0000000..70a98ce --- /dev/null +++ b/modules/nixfiles/games/minecraft.nix @@ -0,0 +1,15 @@ +{ + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.nixfiles.modules.games.minecraft; +in { + options.nixfiles.modules.games.minecraft.enable = + mkEnableOption "Whether to enable Minecraft."; + + config = + mkIf cfg.enable {hm.home.packages = with pkgs; [jre nixfiles.UltimMC];}; +} diff --git a/modules/nixfiles/games/steam-run.nix b/modules/nixfiles/games/steam-run.nix new file mode 100644 index 0000000..983cc77 --- /dev/null +++ b/modules/nixfiles/games/steam-run.nix @@ -0,0 +1,59 @@ +{ + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.nixfiles.modules.games.steam-run; +in { + options.nixfiles.modules.games.steam-run = { + enable = mkEnableOption "Whether to enable native Steam runtime."; + + quirks = { + mountandblade = mkEnableOption ''Fix "Mount & Blade: Warband" issues.''; + }; + }; + + config = mkIf cfg.enable { + nixfiles.modules = { + games = { + enable32BitSupport = true; + gamemode.enable = true; + }; + }; + + hm.home.packages = with pkgs; [ + (steam.override { + extraLibraries = _: + with cfg.quirks; + optionals mountandblade [ + (glew.overrideAttrs (_: super: let + opname = super.pname; + in rec { + pname = "${opname}-mountandblade"; + inherit (super) version; + src = fetchurl { + url = "mirror://sourceforge/${opname}/${opname}-${version}.tgz"; + sha256 = "sha256-BN6R5+Z2MDm8EZQAlc2cf4gLq6ghlqd2X3J6wFqZPJU="; + }; + })) + (fmodex.overrideAttrs (_: super: let + opname = super.pname; + in rec { + pname = "${opname}-mountandblade"; + 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 + ]; + }; +} diff --git a/modules/nixfiles/games/steam.nix b/modules/nixfiles/games/steam.nix new file mode 100644 index 0000000..c1d471e --- /dev/null +++ b/modules/nixfiles/games/steam.nix @@ -0,0 +1,21 @@ +{ + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.nixfiles.modules.games.steam; +in { + options.nixfiles.modules.games.steam.enable = + mkEnableOption "Whether to enable Steam runtime."; + + config = mkIf cfg.enable { + nixfiles.modules.games = { + enable32BitSupport = true; + gamemode.enable = true; + }; + + hm.home.packages = with pkgs; [steam]; + }; +} |