From 17355b0a42a2c0afc9f53cd0fe7be04378e5669a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tristan=20Dani=C3=ABl=20Maat?= Date: Mon, 26 Jul 2021 01:49:18 +0100 Subject: [PATCH] voor-kia: Add client mods --- pkgs/build-support/fetchFromCurseForge.nix | 5 +- pkgs/default.nix | 1 + pkgs/minecraft/voor-kia-client.nix | 8 ++ pkgs/minecraft/voor-kia/client-mods.json | 86 ++++++++++++++++++++++ pkgs/minecraft/voor-kia/update-mods.py | 8 +- 5 files changed, 104 insertions(+), 4 deletions(-) create mode 100644 pkgs/minecraft/voor-kia-client.nix create mode 100644 pkgs/minecraft/voor-kia/client-mods.json diff --git a/pkgs/build-support/fetchFromCurseForge.nix b/pkgs/build-support/fetchFromCurseForge.nix index 5d4f232..e3e5b51 100644 --- a/pkgs/build-support/fetchFromCurseForge.nix +++ b/pkgs/build-support/fetchFromCurseForge.nix @@ -12,12 +12,15 @@ let # really an odd one... a = head (match "0*([[:digit:]]+)" (substring 0 4 (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" ]; in fetchurl (otherArgs // { inherit url; # Rename files to avoid names incompatible with the nix store name = "${project}.jar"; + # Avoid accidental URL globbing + curlOpts = "--globoff"; }) diff --git a/pkgs/default.nix b/pkgs/default.nix index 0748ae6..88a0112 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -12,4 +12,5 @@ in { # Minecraft modpacks voor-kia = callPackage ./minecraft/voor-kia.nix { }; + voor-kia-client = callPackage ./minecraft/voor-kia-client.nix { }; } diff --git a/pkgs/minecraft/voor-kia-client.nix b/pkgs/minecraft/voor-kia-client.nix new file mode 100644 index 0000000..235bacd --- /dev/null +++ b/pkgs/minecraft/voor-kia-client.nix @@ -0,0 +1,8 @@ +{ lib, local-lib, stdenv }: + +local-lib.minecraft.mkModpack { + 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)); +} diff --git a/pkgs/minecraft/voor-kia/client-mods.json b/pkgs/minecraft/voor-kia/client-mods.json new file mode 100644 index 0000000..960f7ab --- /dev/null +++ b/pkgs/minecraft/voor-kia/client-mods.json @@ -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" + } +] \ No newline at end of file diff --git a/pkgs/minecraft/voor-kia/update-mods.py b/pkgs/minecraft/voor-kia/update-mods.py index 0af0b09..df32d86 100644 --- a/pkgs/minecraft/voor-kia/update-mods.py +++ b/pkgs/minecraft/voor-kia/update-mods.py @@ -1,6 +1,7 @@ import argparse import json import hashlib +import pathlib from copy import deepcopy from enum import Enum from typing import Dict, Generator, NamedTuple, Optional, Union @@ -76,6 +77,7 @@ def main(): parser.add_argument( "--mod-loader", choices=["none", "forge", "fabric"], default="forge" ) + parser.add_argument("--infile", type=pathlib.Path) args = parser.parse_args() if args.mod_loader == "forge": @@ -85,11 +87,11 @@ def main(): else: raise AssertionError("Unreachable") - update(args.version, mod_loader) + update(args.infile, args.version, mod_loader) -def update(version: str, mod_loader: ModLoader): - with open("./mods.json") as mods_json: +def update(infile: pathlib.Path, version: str, mod_loader: ModLoader): + with open(infile) as mods_json: mods = json.load(mods_json) curse = CurseAPI()