nix/home-manager/modules/prismlauncher.nix

82 lines
3.3 KiB
Nix
Raw Permalink Normal View History

2024-12-21 11:15:14 -07:00
{ lib, pkgs, config, ... }:
{
options = {
programs.custom.prism-launcher = {
enable = lib.mkEnableOption "prism launcher";
package = lib.mkPackageOption pkgs "Prism Launcher" {
default = "prismlauncher";
};
javaPackages = lib.mkOption {
type = lib.types.listOf lib.types.package;
default = [
# These three JREs cover most minecraft versions
pkgs.temurin-jre-bin-21
pkgs.temurin-jre-bin-17
pkgs.temurin-jre-bin-8
];
defaultText = lib.literalExpression "with pkgs; [ temurin-jre-bin-21 temurin-jre-bin-17 temurin-jre-bin-8 ]";
description = "The java packages to provide to Prism Launcher for running the game";
};
additionalPrograms = lib.mkOption {
type = lib.types.listOf lib.types.package;
default = [];
defaultText = lib.literalExpression "[]";
description = ''
Additional programs that will be added to Prism Launcher's PATH.
Use this for mods that require an extra binary to be present to function.
'';
};
additionalLibs = lib.mkOption {
type = lib.types.listOf lib.types.package;
default = [];
defaultText = lib.literalExpression "[]";
description = ''
Additional dynamic libraries that will be added to Prism Launcher's LD_LIBRARY_PATH.
Use this for mods that require an extra native library to be present to function.
'';
};
controllerSupport = lib.mkOption {
type = lib.types.bool;
default = true;
defaultText = lib.literalExpression "true";
description = "Whether to enable controller support for Prism Launcher";
};
gamemodeSupport = lib.mkOption {
type = lib.types.bool;
default = true;
defaultText = lib.literalExpression "true";
description = "Whether to enable Feral GameMode support for Prism Launcher";
};
textToSpeechSupport = lib.mkOption {
type = lib.types.bool;
default = true;
defaultText = lib.literalExpression "true";
description = "Whether to enable text-to-speech support for Prism Launcher";
};
msaClientID = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
defaultText = lib.literalExpression "null";
description = ''
A custom MSA Client ID to use for authentication with microsoft servers.
Do not override this unless truly necessary.
'';
};
};
};
config = let
cfg = config.programs.custom.prism-launcher;
in lib.mkIf cfg.enable {
home.packages = [ (cfg.package.override {
jdks = cfg.javaPackages;
inherit (cfg) additionalPrograms additionalLibs controllerSupport gamemodeSupport textToSpeechSupport msaClientID;
}) ];
};
}