Add support for building minecraft modpacks
This commit is contained in:
parent
b474f7e97c
commit
a9e3610744
6 changed files with 121 additions and 11 deletions
8
lib/default.nix
Normal file
8
lib/default.nix
Normal file
|
@ -0,0 +1,8 @@
|
|||
{ inputs, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) makeExtensible foldr attrValues;
|
||||
tlater-lib = makeExtensible (self:
|
||||
let callLibs = file: import file { inherit self lib pkgs inputs; };
|
||||
in { minecraft = callLibs ./minecraft.nix; });
|
||||
in tlater-lib.extend (self: super: foldr (a: b: a // b) { } (attrValues super))
|
30
lib/minecraft.nix
Normal file
30
lib/minecraft.nix
Normal file
|
@ -0,0 +1,30 @@
|
|||
{ 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
|
||||
'';
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue