summaryrefslogtreecommitdiffstats
path: root/pkgs/tools/games/minecraft/optifine/generic.nix
blob: 2d8778987d3a9d3184960dffdd46ad572c05e4e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
{
  version,
  sha256,
  lib,
  runCommand,
  fetchurl,
  makeWrapper,
  jre,
}:

let
  mcVersion = builtins.head (lib.splitString "_" version);
in
runCommand "optifine-${mcVersion}"
  {
    pname = "optifine";
    inherit version;

    src = fetchurl {
      url = "https://optifine.net/download?f=OptiFine_${version}.jar";
      inherit sha256;
      name = "OptiFine_${version}.jar";
    };

    nativeBuildInputs = [
      jre
      makeWrapper
    ];

    passthru.updateScript = {
      command = [ ./update.py ];
      supportedFeatures = [ "commit" ];
    };

    meta = {
      homepage = "https://optifine.net/";
      description = "Minecraft ${mcVersion} optimization mod";
      longDescription = ''
        OptiFine is a Minecraft optimization mod.
        It allows Minecraft to run faster and look better with full support for HD textures and many configuration options.
        This is for version ${mcVersion} of Minecraft.
      '';
      sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
      license = lib.licenses.unfree;
      maintainers = [ ];
      platforms = lib.platforms.unix;
      mainProgram = "optifine";
    };
  }
  ''
    mkdir -p $out/{bin,lib/optifine}
    cp $src $out/lib/optifine/optifine.jar

    makeWrapper ${jre}/bin/java $out/bin/optifine \
      --add-flags "-jar $out/lib/optifine/optifine.jar"
  ''