163 lines
5.5 KiB
Nix
163 lines
5.5 KiB
Nix
{ lib, config, ... }:
|
|
with lib;
|
|
{
|
|
# TODO: abstract this away from what neoforge asks for, and generalize it to all mod loaders
|
|
options = {
|
|
modid = mkOption {
|
|
type = types.str;
|
|
description = "The modid of the mod.";
|
|
};
|
|
version = mkOption {
|
|
type = types.str;
|
|
description = "The version of the mod.";
|
|
};
|
|
displayName = mkOption {
|
|
type = types.str;
|
|
description = "The display name of the mod.";
|
|
};
|
|
authors = mkOption {
|
|
type = types.listOf types.str;
|
|
default = [ ];
|
|
description = "The authors of the mod.";
|
|
};
|
|
description = mkOption {
|
|
type = types.str;
|
|
description = "The description of the mod.";
|
|
};
|
|
|
|
targetFramework = mkOption {
|
|
type = types.listOf (types.enum [ "forge" "neoforge" "fabric" "quilt" ]);
|
|
description = "The target framework of the mod.";
|
|
};
|
|
|
|
targetVersion = mkOption {
|
|
type = types.str;
|
|
description = "The target minecraft version of the mod.";
|
|
};
|
|
|
|
frameworkVersion = mkOption {
|
|
type = types.str;
|
|
default = "latest-recommended";
|
|
description = "The target framework version of the mod.";
|
|
};
|
|
|
|
javaPackage = mkOption {
|
|
type = types.str;
|
|
default = "com.example.${config.modid}";
|
|
description = "The Java package the mod's sources live under.";
|
|
};
|
|
|
|
|
|
className = mkOption {
|
|
type = types.str;
|
|
default =
|
|
if config.customClass != null
|
|
then removeSuffix ".java" (baseNameOf config.customClass)
|
|
else toUpper (substring 0 1 config.modid) + substring 1 (-1) config.modid;
|
|
description = ''
|
|
The name of the generated main mod class. Defaults to customClass's own
|
|
basename when set (so the hand-written file's "extends ...Base" clause
|
|
lines up automatically), else the capitalized modid.
|
|
'';
|
|
};
|
|
|
|
customClass = mkOption {
|
|
type = types.nullOr types.str;
|
|
default = null;
|
|
description = ''
|
|
Path (relative to this mod.nix) to a hand-written Java file whose public
|
|
class extends the generated "''${className}Base" class. When unset, snowy
|
|
generates one flat, concrete, @Mod-annotated main class instead.
|
|
'';
|
|
};
|
|
|
|
clientClassName = mkOption {
|
|
type = types.str;
|
|
default =
|
|
if config.customClientClass != null
|
|
then removeSuffix ".java" (baseNameOf config.customClientClass)
|
|
else "${config.className}Client";
|
|
description = ''
|
|
The name of the generated client-only mod class. Defaults to
|
|
customClientClass's own basename when set, else "''${className}Client".
|
|
'';
|
|
};
|
|
|
|
customClientClass = mkOption {
|
|
type = types.nullOr types.str;
|
|
default = null;
|
|
description = ''
|
|
Path (relative to this mod.nix) to a hand-written Java file whose public
|
|
class extends the generated "''${clientClassName}Base" class. When unset,
|
|
snowy generates one flat, concrete, @Mod(dist = CLIENT)-annotated class
|
|
instead.
|
|
'';
|
|
};
|
|
|
|
dependencies = mkOption {
|
|
type = types.listOf (types.submodule {
|
|
options = {
|
|
modId = mkOption {
|
|
type = types.str;
|
|
description = "The modid of the dependency.";
|
|
};
|
|
type = mkOption {
|
|
type = types.enum [ "required" "optional" "incompatible" "discouraged" ];
|
|
description = "The kind of dependency relationship.";
|
|
};
|
|
versionRange = mkOption {
|
|
type = types.str;
|
|
description = "The version range of the dependency.";
|
|
};
|
|
ordering = mkOption {
|
|
type = types.enum [ "before" "after" "none" ];
|
|
default = "none";
|
|
description = "Load ordering relative to the dependency.";
|
|
};
|
|
side = mkOption {
|
|
type = types.enum [ "client" "server" "both" ];
|
|
default = "both";
|
|
description = "The side this dependency is required on.";
|
|
};
|
|
};
|
|
});
|
|
default = [ ];
|
|
description = "The dependencies of the mod.";
|
|
};
|
|
license = mkOption {
|
|
type = types.str;
|
|
description = "The license of the mod.";
|
|
};
|
|
|
|
javaDependencies = mkOption {
|
|
type = types.listOf (types.submodule {
|
|
options = {
|
|
coordinate = mkOption {
|
|
type = types.str;
|
|
description = "Maven coordinate of the dependency, as group:artifact:version.";
|
|
};
|
|
configuration = mkOption {
|
|
type = types.enum [ "implementation" "api" "compileOnly" "runtimeOnly" ];
|
|
default = "implementation";
|
|
description = "The Gradle dependency configuration to add the coordinate under.";
|
|
};
|
|
};
|
|
});
|
|
default = [ ];
|
|
description = "Plain Maven/Java dependencies (not other mods) to add to the Gradle build.";
|
|
};
|
|
|
|
mavenRepositories = mkOption {
|
|
type = types.listOf types.str;
|
|
default = [ ];
|
|
description = "Additional Maven repository URLs to resolve javaDependencies from. mavenCentral() is always included.";
|
|
};
|
|
|
|
features = mkOption {
|
|
type = types.listOf (types.attrsOf types.str);
|
|
default = [ ];
|
|
description = "Features the mod requires in the game";
|
|
};
|
|
};
|
|
}
|