voor-kia: Add client mods

This commit is contained in:
Tristan Daniël Maat 2021-07-26 01:49:18 +01:00
parent bb37fddff6
commit 7f3ef18ff8
Signed by: tlater
GPG key ID: 49670FD774E43268
6 changed files with 125 additions and 4 deletions

View file

@ -27,4 +27,25 @@
cp * $out/mods cp * $out/mods
''; '';
}; };
mkModpackZip = { name, version, mods }:
pkgs.stdenv.mkDerivation {
inherit name version;
srcs = map pkgs.local.fetchFromCurseForge mods;
sourceRoot = "src/";
preUnpack = "mkdir -p src/";
unpackCmd = "cp $curSrc src/";
buildInputs = [ pkgs.zip];
buildPhase = ''
zip voor-kia-mods.zip *.jar
'';
installPhase = ''
mkdir -p $out/
cp voor-kia-mods.zip $out/
'';
};
} }

View file

@ -12,12 +12,15 @@ let
# really an odd one... # really an odd one...
a = head (match "0*([[:digit:]]+)" (substring 0 4 (toString id))); a = head (match "0*([[:digit:]]+)" (substring 0 4 (toString id)));
b = head (match "0*([[:digit:]]+)" (substring 4 7 (toString id))); b = head (match "0*([[:digit:]]+)" (substring 4 7 (toString id)));
encoded-filename = replaceStrings [ " " ] [ "%20" ] filename;
url = "https://media.forgecdn.net/files/${a}/${b}/${filename}"; url = "https://media.forgecdn.net/files/${a}/${b}/${encoded-filename}";
otherArgs = removeAttrs args [ "project" "project_id" "id" "filename" ]; otherArgs = removeAttrs args [ "project" "project_id" "id" "filename" ];
in fetchurl (otherArgs // { in fetchurl (otherArgs // {
inherit url; inherit url;
# Rename files to avoid names incompatible with the nix store # Rename files to avoid names incompatible with the nix store
name = "${project}.jar"; name = "${project}.jar";
# Avoid accidental URL globbing
curlOpts = "--globoff";
}) })

View file

@ -12,4 +12,5 @@ in {
# Minecraft modpacks # Minecraft modpacks
voor-kia = callPackage ./minecraft/voor-kia.nix { }; voor-kia = callPackage ./minecraft/voor-kia.nix { };
voor-kia-client = callPackage ./minecraft/voor-kia-client.nix { };
} }

View file

@ -0,0 +1,8 @@
{ lib, local-lib, stdenv }:
local-lib.minecraft.mkModpackZip {
name = "voor-kia-client";
version = "1.1";
mods = (builtins.fromJSON (builtins.readFile ./voor-kia/mods.json))
++ (builtins.fromJSON (builtins.readFile ./voor-kia/client-mods.json));
}

View file

@ -0,0 +1,86 @@
[
{
"filename": "AmbientSounds_v3.1.9_mc1.16.5.jar",
"id": 3334857,
"project": "ambientsounds",
"project_id": 254284,
"sha256": "c8ed21587fe96745695aa9a8f23b6effbcc6a5c5340aed11b8515c0e0aa2c310"
},
{
"filename": "BackTools-1.16.5-10.1.0.jar",
"id": 3224955,
"project": "back-tools",
"project_id": 229061,
"sha256": "cd5ed82919dd8acf2874c7edadba5bacfaffa898e572f8574241329e4478518e"
},
{
"filename": "BetterAdvancements-1.16.5-0.1.1.111.jar",
"id": 3400299,
"project": "better-advancements",
"project_id": 272515,
"sha256": "83c159f83bebc1d0f72c9de465bdcbeb2b02a56b88dcaa6661fe54df50a9aab5"
},
{
"filename": "Controlling-7.0.0.23.jar",
"id": 3348514,
"project": "controlling",
"project_id": 250398,
"sha256": "627308ed0b4fc1fdcc75113db8412c0684c3a774d1c6a07ae993543e605f5655"
},
{
"filename": "EntityCulling-1.16.5-2.1.6.jar",
"id": 3328602,
"project": "entity-culling",
"project_id": 409087,
"sha256": "eede3bfc68f48acb3e06fec2ea280510287cd5d492a02b8ace8e0dda742d7342"
},
{
"filename": "ftb-library-forge-1605.3.1-build.48.jar",
"id": 3373833,
"project": "ftb-library-forge",
"project_id": 404465,
"sha256": "f4f87f464796ee6ff7c80fb1fbc5753ac191138b6aa6b1a30c1b55252b3bf0a8"
},
{
"filename": "InventoryHud_[1.16.2-1.16.5].forge-3.3.0.jar",
"id": 3296748,
"project": "inventory-hud-forge",
"project_id": 357540,
"sha256": "2b3a4f02fe84b717c9273ea14cea0912267c2c093fc2cdfcde2b6f032c9762e7"
},
{
"filename": "MouseTweaks-2.14-mc1.16.2.jar",
"id": 3202662,
"project": "mouse-tweaks",
"project_id": 60089,
"sha256": "9d7e1aaee9f814c26d896e084e6e86930ab99e19fe547a1d350a6e25e4267092"
},
{
"filename": "namepain-1.4.0 forge-1.16.x.jar",
"id": 3356725,
"project": "name-pain",
"project_id": 366263,
"sha256": "5cc9e83b6d06810cbfcc155ddcfbe417cd4553a2665025affd1b71bee0138f68"
},
{
"filename": "overloadedarmorbar-5.1.0.jar",
"id": 3055679,
"project": "overloaded-armor-bar",
"project_id": 314002,
"sha256": "8aff59f170ef2c7598dc0f2367842f4384e57c13111507468da32498fc0ac4ea"
},
{
"filename": "shutupexperimentalsettings-1.0.3.jar",
"id": 3188120,
"project": "shutup-experimental-settings",
"project_id": 407174,
"sha256": "22ce84a0d424c2d48e483cb873909ac5c8c322bc793d09365ad44b901f43de62"
},
{
"filename": "Toast-Control-1.16.4-4.3.1.jar",
"id": 3172881,
"project": "toast-control",
"project_id": 271740,
"sha256": "b1cb36b7615c846f08c72423b2b52417b55eea91ca812bb7629a8f3060f5efae"
}
]

View file

@ -1,6 +1,7 @@
import argparse import argparse
import json import json
import hashlib import hashlib
import pathlib
from copy import deepcopy from copy import deepcopy
from enum import Enum from enum import Enum
from typing import Dict, Generator, NamedTuple, Optional, Union from typing import Dict, Generator, NamedTuple, Optional, Union
@ -76,6 +77,7 @@ def main():
parser.add_argument( parser.add_argument(
"--mod-loader", choices=["none", "forge", "fabric"], default="forge" "--mod-loader", choices=["none", "forge", "fabric"], default="forge"
) )
parser.add_argument("--infile", type=pathlib.Path)
args = parser.parse_args() args = parser.parse_args()
if args.mod_loader == "forge": if args.mod_loader == "forge":
@ -85,11 +87,11 @@ def main():
else: else:
raise AssertionError("Unreachable") raise AssertionError("Unreachable")
update(args.version, mod_loader) update(args.infile, args.version, mod_loader)
def update(version: str, mod_loader: ModLoader): def update(infile: pathlib.Path, version: str, mod_loader: ModLoader):
with open("./mods.json") as mods_json: with open(infile) as mods_json:
mods = json.load(mods_json) mods = json.load(mods_json)
curse = CurseAPI() curse = CurseAPI()