tlaternet-server/lib/minecraft.nix

52 lines
1 KiB
Nix

{ lib, pkgs, ... }:
{
# Make a modpack given its mod inputs.
#
# Mods should be attrsets in this format:
# {
# project = "";
# id = "";
# filename = "";
# sha256 = "";
# }
#
# This may be nice to read from a json ;)
#
mkModpack = { 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/";
installPhase = ''
mkdir -p $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/
'';
};
}