nixos-config/packages/minecraft/luckperms.nix

116 lines
3.8 KiB
Nix
Raw Normal View History

2022-06-12 15:39:15 +00:00
{
coreutils,
fetchFromGitHub,
findutils,
git,
gnused,
gradle,
openjdk17_headless,
perl,
stdenv,
lib,
fetchurl,
...
}: let
2022-02-20 15:30:04 +00:00
pname = "LuckPerms";
2022-04-14 07:47:33 +00:00
version = "2022-04-08";
2022-02-20 15:30:04 +00:00
src = fetchFromGitHub {
owner = "LuckPerms";
repo = "LuckPerms";
2022-04-14 07:47:33 +00:00
rev = "207e4aa9f8c640ad3b17f844d79512f7b8fb2044";
sha256 = "00xkhma322b19h93ccand8ldj2pn3jf43jcmpcpaakaaqrk2ph0x";
2022-02-20 15:30:04 +00:00
leaveDotGit = true;
};
# Adds a gradle step that downloads all the dependencies to the gradle cache.
addResolveStep = ''
git tag v5.4 # thanks build script
${gnused}/bin/sed -i "s#'fabric',##" settings.gradle
cat >>build.gradle <<HERE
task resolveDependencies {
doLast {
project.rootProject.allprojects.each { subProject ->
subProject.buildscript.configurations.each { configuration ->
resolveConfiguration(subProject, configuration, "buildscript config \''${configuration.name}")
}
subProject.configurations.each { configuration ->
resolveConfiguration(subProject, configuration, "config \''${configuration.name}")
}
}
}
}
void resolveConfiguration(subProject, configuration, name) {
if (configuration.canBeResolved) {
logger.info("Resolving project {} {}", subProject.name, name)
configuration.resolve()
}
}
HERE
'';
deps = stdenv.mkDerivation {
pname = "${pname}-deps";
inherit version src;
2022-06-12 15:39:15 +00:00
nativeBuildInputs = [git];
2022-02-20 15:30:04 +00:00
postPatch = addResolveStep;
buildPhase = ''
export GRADLE_USER_HOME=$(${coreutils}/bin/mktemp -d)
# Fetch the maven dependencies.
${gradle}/bin/gradle --no-daemon --info -Dorg.gradle.java.home=${openjdk17_headless} resolveDependencies
'';
installPhase = ''
${findutils}/bin/find $GRADLE_USER_HOME/caches/modules-2 -type f -regex '.*\.\(jar\|pom\)' \
| ${perl}/bin/perl -pe 's#(.*/([^/]+)/([^/]+)/([^/]+)/[0-9a-f]{30,40}/([^/\s]+))$# ($x = $2) =~ tr|\.|/|; "${coreutils}/bin/install -Dm444 $1 \$out/maven/$x/$3/$4/$5" #e' \
| sh
'';
outputHashAlgo = "sha256";
outputHashMode = "recursive";
2022-04-14 07:47:33 +00:00
outputHash = "sha256-V7FlGxa+Q3ljohPldxlhi2Ak93TiEUggwFELLaR787w=";
2022-02-20 15:30:04 +00:00
};
in
2022-06-12 15:39:15 +00:00
/*
2023-06-25 07:28:10 +00:00
stdenv.mkDerivation {
inherit pname version src;
name = "${pname}-${version}.jar";
nativeBuildInputs = [ git ];
postPatch = addResolveStep;
buildPhase = ''
${gnused}/bin/sed -i "s#'bukkit-legacy',##" settings.gradle
${gnused}/bin/sed -i "s#'bukkit-legacy:loader',##" settings.gradle
${gnused}/bin/sed -i "s#'bungee',##" settings.gradle
${gnused}/bin/sed -i "s#'bungee:loader',##" settings.gradle
${gnused}/bin/sed -i "s#'nukkit',##" settings.gradle
${gnused}/bin/sed -i "s#'nukkit:loader',##" settings.gradle
${gnused}/bin/sed -i "s#'sponge',##" settings.gradle
${gnused}/bin/sed -i "s#'sponge:loader',##" settings.gradle
${gnused}/bin/sed -i "s#'sponge:sponge-service',##" settings.gradle
${gnused}/bin/sed -i "s#'sponge:sponge-service-api8',##" settings.gradle
${gnused}/bin/sed -i "s#'velocity'##" settings.gradle
export GRADLE_USER_HOME=$(${coreutils}/bin/mktemp -d)
# add local maven repo
${gnused}/bin/sed -i "s#mavenCentral()#mavenCentral(); maven { url '${deps}/maven' }#" build.gradle
${gnused}/bin/sed -i "s#jcenter()#jcenter(); maven { url '${deps}/maven' }#" settings.gradle
${gnused}/bin/sed -i "s#'fabric',##" settings.gradle
${gradle}/bin/gradle --offline --no-daemon --info -Dorg.gradle.java.home=${openjdk17_headless} build
'';
installPhase = ''
cp bukkit/loader/build/libs/LuckPerms-Bukkit-5.4.0.jar $out
'';
}
*/
2022-06-12 15:39:15 +00:00
fetchurl {
2023-06-25 07:28:10 +00:00
url = "https://ci.lucko.me/job/LuckPerms/lastSuccessfulBuild/artifact/bukkit/loader/build/libs/LuckPerms-Bukkit-5.4.94.jar";
sha256 = "b8c3e38bb5738ca5678b4e8b14c5fef3484eba3da6455fa3ac6a67c923ff539d";
2022-06-12 15:39:15 +00:00
}