From fef4ae3023a602f6379357b11382fd5ca53e73e5 Mon Sep 17 00:00:00 2001 From: Arpit Chakladar Date: Sat, 18 Jul 2026 15:29:03 +0530 Subject: refactor(gaming): extract heroic into its own module, nest steam/heroic into subdirectories MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Create modules/gaming/heroic/default.nix with gaming.heroic.{enable,package} options, including gamemode LD_LIBRARY_PATH wrapping and mime handler Move steam.nix → steam/default.nix and heroic.nix → heroic/default.nix Strip heroic out of the gaming.launcher bundle in default.nix --- modules/gaming/default.nix | 44 +++------------------------------------ modules/gaming/heroic/default.nix | 38 +++++++++++++++++++++++++++++++++ modules/gaming/steam.nix | 21 ------------------- modules/gaming/steam/default.nix | 21 +++++++++++++++++++ 4 files changed, 62 insertions(+), 62 deletions(-) create mode 100644 modules/gaming/heroic/default.nix delete mode 100644 modules/gaming/steam.nix create mode 100644 modules/gaming/steam/default.nix (limited to 'modules') diff --git a/modules/gaming/default.nix b/modules/gaming/default.nix index a4e5c0f..463c138 100644 --- a/modules/gaming/default.nix +++ b/modules/gaming/default.nix @@ -1,46 +1,8 @@ # Gaming - Collection of game launchers and gaming utilities -{ - config, - pkgs, - lib, - ... -}: +{ ... }: { imports = [ - ./steam.nix + ./heroic + ./steam ]; - - options.gaming = { - enable = lib.mkEnableOption "gaming tools bundle (Heroic, winetricks, gamemode)."; - launcher = lib.mkOption { - type = lib.types.package; - default = pkgs.symlinkJoin { - name = "heroic-bundle"; - paths = with pkgs; [ - # Wrap Heroic so it dynamically appends gamemode's library folder to LD_LIBRARY_PATH - (pkgs.symlinkJoin { - name = "heroic-wrapped"; - paths = [ heroic ]; - buildInputs = [ pkgs.makeWrapper ]; - postBuild = '' - wrapProgram $out/bin/heroic \ - --prefix LD_LIBRARY_PATH : "${pkgs.gamemode.lib}/lib:${pkgs.pkgsi686Linux.gamemode.lib}/lib" - ''; - }) - winetricks - xdg-user-dirs - gamemode - ]; - }; - description = "Bundle of game launchers (Heroic), winetricks, and core gaming utilities with GameMode support."; - }; - }; - - config = lib.mkIf config.gaming.enable { - home.packages = [ config.gaming.launcher ]; - - xdg.mimeApps.defaultApplications = { - "x-scheme-handler/heroic" = "heroic.desktop"; - }; - }; } diff --git a/modules/gaming/heroic/default.nix b/modules/gaming/heroic/default.nix new file mode 100644 index 0000000..9c07f17 --- /dev/null +++ b/modules/gaming/heroic/default.nix @@ -0,0 +1,38 @@ +# Heroic Games Launcher - Epic/GOG/Amazon game launcher +{ + config, + pkgs, + lib, + ... +}: +{ + options.gaming.heroic = { + enable = lib.mkEnableOption "Enables Heroic Games Launcher."; + package = lib.mkOption { + type = lib.types.package; + default = pkgs.symlinkJoin { + name = "heroic-wrapped"; + paths = with pkgs; [ + winetricks + xdg-user-dirs + gamemode + heroic + ]; + buildInputs = [ pkgs.makeWrapper ]; + postBuild = '' + wrapProgram $out/bin/heroic \ + --prefix LD_LIBRARY_PATH : "${pkgs.gamemode.lib}/lib:${pkgs.pkgsi686Linux.gamemode.lib}/lib" + ''; + }; + description = "Heroic Games Launcher package (wrapped with GameMode support)."; + }; + }; + + config = lib.mkIf config.gaming.heroic.enable { + home.packages = [ config.gaming.heroic.package ]; + + xdg.mimeApps.defaultApplications = { + "x-scheme-handler/heroic" = "heroic.desktop"; + }; + }; +} diff --git a/modules/gaming/steam.nix b/modules/gaming/steam.nix deleted file mode 100644 index ba3cf0f..0000000 --- a/modules/gaming/steam.nix +++ /dev/null @@ -1,21 +0,0 @@ -# Steam - game store -{ - config, - pkgs, - lib, - ... -}: -{ - options.gaming.steam = { - enable = lib.mkEnableOption "Enables steam."; - package = lib.mkOption { - type = lib.types.package; - default = pkgs.steam; - description = "Package for steam app."; - }; - }; - - config = lib.mkIf config.gaming.steam.enable { - home.packages = [ config.gaming.steam.package ]; - }; -} diff --git a/modules/gaming/steam/default.nix b/modules/gaming/steam/default.nix new file mode 100644 index 0000000..ba3cf0f --- /dev/null +++ b/modules/gaming/steam/default.nix @@ -0,0 +1,21 @@ +# Steam - game store +{ + config, + pkgs, + lib, + ... +}: +{ + options.gaming.steam = { + enable = lib.mkEnableOption "Enables steam."; + package = lib.mkOption { + type = lib.types.package; + default = pkgs.steam; + description = "Package for steam app."; + }; + }; + + config = lib.mkIf config.gaming.steam.enable { + home.packages = [ config.gaming.steam.package ]; + }; +} -- cgit v1.2.3