Skip to content

Commit

Permalink
lutris: configuration init
Browse files Browse the repository at this point in the history
Initial work to bring home-manager configuration to Lutris. Due to
some limitation on how Lutris rewrites on runtime the .conf file,
only the runners and the extra packages will be addressed in this
patchset.
  • Loading branch information
Steinhagen committed Dec 18, 2024
1 parent 83ecd50 commit a5e2f64
Show file tree
Hide file tree
Showing 2 changed files with 113 additions and 0 deletions.
1 change: 1 addition & 0 deletions modules/modules.nix
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ let
./programs/lieer.nix
./programs/looking-glass-client.nix
./programs/lsd.nix
./programs/lutris.nix
./programs/man.nix
./programs/mangohud.nix
./programs/matplotlib.nix
Expand Down
112 changes: 112 additions & 0 deletions modules/programs/lutris.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
{ config, lib, pkgs, ... }:

with lib;
let
cfg = config.programs.lutris;

cemuConf = ''
cemu:
runner_executable: ${pkgs.cemu}/bin/cemu
'';
dolphinConf = ''
dolphin:
runner_executable: ${cfg.runners.dolphin.package}/bin/dolphin-emu
'';
duckstationConf = ''
duckstation:
runner_executable: ${pkgs.duckstation}/bin/duckstation-qt
'';
pcsx2Conf = ''
pcsx2:
runner_executable: ${pkgs.pcsx2}/bin/pcsx2-qt
'';
ppssppConf = ''
ppsspp:
runner_executable: ${cfg.runners.ppsspp.package}/bin/ppsspp
'';
rpcs3Conf = ''
rpcs3:
runner_executable: ${pkgs.rpcs3}/bin/rpcs3
'';

in {
meta.maintainers = [ maintainers.rapiteanu ];

options = {
programs.lutris = {
enable = mkEnableOption "Open Source gaming platform for GNU/Linux";

package = mkOption {
type = types.package;
default = pkgs.lutris;
defaultText = literalExpression "pkgs.lutris";
description = "The Lutris package to use.";
};

extraPackages = mkOption {
type = with types; listOf package;
default = [ ];
example =
literalExpression "[ pkgs.wineWowPackages.staging pkgs.winetricks ]";
description = "Packages that should be available to Lutris.";
};

runners = {
cemu.enable = mkEnableOption "cemu";

dolphin = {
enable = mkEnableOption "dolphin-emu";
package = mkOption {
type = types.package;
default = pkgs.dolphin-emu;
defaultText = literalExpression "pkgs.dolphin-emu";
description = "The Lutris Dolphin Emulator package to use.";
};
};

duckstation.enable = mkEnableOption "duckstation";

pcsx2.enable = mkEnableOption "pcsx2";

ppsspp = {
enable = mkEnableOption "ppsspp";
package = mkOption {
type = types.package;
default = pkgs.ppsspp;
defaultText = literalExpression "pkgs.ppsspp";
description = "The Lutris PPSSPP package to use.";
};
};

rpcs3.enable = mkEnableOption "rpcs3";
};

};
};

config = mkIf cfg.enable {
home.packages =
[ (cfg.package.override { extraPkgs = pkgs: cfg.extraPackages; }) ]
++ optional cfg.runners.cemu.enable pkgs.cemu
++ optional cfg.runners.dolphin.enable cfg.runners.dolphin.package
++ optional cfg.runners.duckstation.enable pkgs.duckstation
++ optional cfg.runners.pcsx2.enable pkgs.pcsx2
++ optional cfg.runners.ppsspp.enable cfg.runners.ppsspp.package
++ optional cfg.runners.rpcs3.enable pkgs.rpcs3;

xdg.dataFile = {
"lutris/runners/cemu.yml" =
mkIf (cfg.runners.cemu.enable) { text = cemuConf; };
"lutris/runners/dolphin.yml" =
mkIf (cfg.runners.dolphin.enable) { text = dolphinConf; };
"lutris/runners/duckstation.yml" =
mkIf (cfg.runners.duckstation.enable) { text = duckstationConf; };
"lutris/runners/pcsx2.yml" =
mkIf (cfg.runners.pcsx2.enable) { text = pcsx2Conf; };
"lutris/runners/ppsspp.yml" =
mkIf (cfg.runners.ppsspp.enable) { text = ppssppConf; };
"lutris/runners/rpcs3.yml" =
mkIf (cfg.runners.rpcs3.enable) { text = rpcs3Conf; };
};
};
}

0 comments on commit a5e2f64

Please sign in to comment.