Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

purpur-servers: init 1.14.1 up to latest #129

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ As of currently, it packages:
- Legacy Fabric
- Quilt
- Paper
- Purpur
- All supported versions of the following:
- Velocity proxy
- Various tools
Expand Down Expand Up @@ -116,6 +117,20 @@ Since Legacy Fabric does not have a defined newest version to target, it lacks a

If you plan on running paper without internet, you'll have to link the vanilla jar to `cache/mojang_{version}.jar`. The relevant jar is available at the package's `vanillaJar` attribute.

### `purpurServers.*`

[Source](./pkgs/purpur-servers)

`purpurServers` functions the same as `paperServers`.

If you plan on running paper without internet, you'll have to link the vanilla jar to `cache/mojang_{version}.jar`. The relevant jar is available at the package's `vanillaJar` attribute.

List of versions:
```
$ nix repl github:Infinidoge/nix-minecraft
nix-repl> legacyPackages.x86_64-linux.purpurServers.[TAB KEY]
```

### `velocityServers.*`

[Source](./pkgs/velocity-servers)
Expand All @@ -126,7 +141,7 @@ For convenience, `velocityServers.velocity` is equivalent to the latest version.

### `minecraftServers.*`

`vanillaServers // fabricServers // quiltServers // legacyFabricServers // paperServers`. Will be used most often as it contains all of the different server versions across each mod loader. When using the overlay, this will replace the Nixpkgs `minecraftServers`.
`vanillaServers // fabricServers // quiltServers // legacyFabricServers // paperServers // purpurServers`. Will be used most often as it contains all of the different server versions across each mod loader. When using the overlay, this will replace the Nixpkgs `minecraftServers`.

### `fetchPackwizModpack`

Expand Down Expand Up @@ -232,6 +247,7 @@ All of these packages are also available under `packages`, not just `legacyPacka
- `fabric-server`: Same as `fabricServers.fabric`
- `quilt-server`: Same as `quiltServers.quilt`
- `paper-server`: Same as `paperServers.paper`
- `purpur-server`: Same as `purpurServers.purpur`
- `velocity-server`: Same as `velocityServers.velocity`
- `minecraft-server`: Same as `vanilla-server`

Expand Down
10 changes: 9 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,21 @@
quiltServers = callPackage ./pkgs/quilt-servers { inherit vanillaServers; };
legacyFabricServers = callPackage ./pkgs/legacy-fabric-servers { inherit vanillaServers; };
paperServers = callPackage ./pkgs/paper-servers { inherit vanillaServers; };
purpurServers = callPackage ./pkgs/purpur-servers { inherit vanillaServers; };
velocityServers = callPackage ./pkgs/velocity-servers { };
minecraftServers =
vanillaServers // fabricServers // quiltServers // legacyFabricServers // paperServers;
vanillaServers
// fabricServers
// quiltServers
// legacyFabricServers
// paperServers
// purpurServers;

vanilla-server = vanillaServers.vanilla;
fabric-server = fabricServers.fabric;
quilt-server = quiltServers.quilt;
paper-server = paperServers.paper;
purpur-server = purpurServers.purpur;
velocity-server = velocityServers.velocity;
minecraft-server = vanilla-server;
}
Expand Down Expand Up @@ -112,6 +119,7 @@
fabric-server
quilt-server
paper-server
purpur-server
velocity-server
minecraft-server
nix-modrinth-prefetch
Expand Down
218 changes: 218 additions & 0 deletions pkgs/purpur-servers/bad.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
{
"1.14.1": [
"21",
"42",
"1",
"6",
"7",
"25",
"26",
"54",
"61"
],
"1.14.2": [
"64",
"88",
"91",
"93"
],
"1.14.3": [
"127",
"174",
"183",
"190",
"191",
"195",
"196"
],
"1.14.4": [
"203",
"227",
"252",
"284",
"291"
],
"1.15": [
"338"
],
"1.15.1": [
"347"
],
"1.15.2": [
"411",
"412",
"413",
"414",
"415",
"471",
"472",
"473",
"474",
"475",
"476",
"479",
"480",
"481",
"494",
"508",
"515",
"409",
"428",
"433",
"434",
"468",
"469",
"485",
"492",
"523",
"553",
"572",
"598"
],
"1.16.1": [
"644",
"709",
"607",
"690"
],
"1.16.2": [
"741",
"742",
"743",
"744"
],
"1.16.3": [
"751",
"806",
"807"
],
"1.16.4": [
"909",
"809",
"823",
"849",
"856",
"877",
"885",
"891",
"907",
"910",
"923"
],
"1.16.5": [
"988",
"1008",
"1013",
"1037",
"1063",
"1094",
"1145",
"1146",
"1147",
"1148",
"1168"
],
"1.17": [
"1183",
"1186",
"1203",
"1216"
],
"1.17.1": [
"1268",
"1269",
"1273",
"1276",
"1312",
"1401",
"1420",
"1422"
],
"1.18": [],
"1.18.1": [
"1457",
"1490",
"1491",
"1535",
"1536",
"1553"
],
"1.18.2": [
"1617",
"1618",
"1629"
],
"1.19": [
"1643",
"1644",
"1658",
"1673",
"1686",
"1687",
"1688",
"1707",
"1728"
],
"1.19.1": [],
"1.19.2": [
"1837",
"1846"
],
"1.19.3": [
"1914",
"1928"
],
"1.19.4": [
"1936",
"1960"
],
"1.20": [
"1989"
],
"1.20.1": [
"2007",
"2037",
"2061"
],
"1.20.2": [
"2066",
"2069",
"2070",
"2071"
],
"1.20.4": [
"2096",
"2115",
"2116",
"2129",
"2168",
"2170"
],
"1.20.6": [
"2184",
"2194",
"2198",
"2210",
"2216",
"2222",
"2231"
],
"1.21": [
"2237"
],
"1.21.1": [
"2317",
"2320"
],
"1.21.3": [],
"1.21.4": [
"2359",
"2360",
"2361",
"2364",
"2366",
"2368",
"2373",
"2374"
]
}
71 changes: 71 additions & 0 deletions pkgs/purpur-servers/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
callPackage,
lib,
jdk11,
jdk17,
jdk,
vanillaServers,
}:
let
inherit (lib.our) escapeVersion;
inherit (lib)
nameValuePair
flatten
last
versionOlder
mapAttrsToList
;
versions = lib.importJSON ./lock.json;

# Remove -build... suffix
stripBuild = v: builtins.head (builtins.match "(.*)-build.*" v);
# Sort by attribute 'attr' using 'f' function
sortBy = attr: f: builtins.sort (a: b: f a.${attr} b.${attr});

# https://docs.papermc.io/paper/getting-started#requirements
getRecommendedJavaVersion =
v:
# oldest version is 1.14.1
# Version older than 1.1 1.1 = false
if versionOlder v "1.17" then
jdk11
else if versionOlder v "1.18.2" then # paper says 1.18.1+ but 1.18.1 max is 17
jdk17
else
jdk;

getLog4j =
v:
if lib.versionOlder v "1.17" then
"-Dlog4j.configurationFile=" + ./purpur_log4j2_1141-1165.xml
else if lib.versionOlder v "1.18.2" then
"-Dlog4j.configurationFile=" + ./purpur_log4j2_117.xml
else
""; # newer than 1.18.1 are patched.

packages = mapAttrsToList (
mcVersion: builds:
sortBy "version" versionOlder (
mapAttrsToList (
buildNumber: value:
callPackage ./derivation.nix {
inherit (value) url sha256;
version = "${mcVersion}-build.${buildNumber}";
jre = getRecommendedJavaVersion mcVersion;
log4j = getLog4j mcVersion;
minecraft-server = vanillaServers."vanilla-${escapeVersion mcVersion}";
}
) builds
)
) versions;

# Latest build for each MC version
latestBuilds = sortBy "version" versionOlder (map last packages);
in
lib.recurseIntoAttrs (
builtins.listToAttrs (
(map (x: nameValuePair (escapeVersion x.name) x) (flatten packages))
++ (map (x: nameValuePair (escapeVersion (stripBuild x.name)) x) latestBuilds)
++ [ (nameValuePair "purpur" (last latestBuilds)) ]
)
)
Loading