diff --git a/modules/modules.nix b/modules/modules.nix index 5d40a82fc8f5..4ed3c46c1852 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -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 diff --git a/modules/programs/lutris.nix b/modules/programs/lutris.nix new file mode 100644 index 000000000000..cf248c86fe5c --- /dev/null +++ b/modules/programs/lutris.nix @@ -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; }; + }; + }; +}