mirror of
https://git.pvv.ntnu.no/Drift/pvv-nixos-config.git
synced 2026-01-14 11:28:24 +01:00
bekkalokk/bluemap: include markers with concatenation
This commit is contained in:
@@ -21,6 +21,7 @@ in {
|
|||||||
inherit (inputs.minecraft-kartverket.packages.${pkgs.stdenv.hostPlatform.system}) bluemap-export;
|
inherit (inputs.minecraft-kartverket.packages.${pkgs.stdenv.hostPlatform.system}) bluemap-export;
|
||||||
in {
|
in {
|
||||||
"verden" = {
|
"verden" = {
|
||||||
|
extraHoconMarkersFile = "${bluemap-export}/overworld.hocon";
|
||||||
settings = {
|
settings = {
|
||||||
world = vanillaSurvival;
|
world = vanillaSurvival;
|
||||||
dimension = "minecraft:overworld";
|
dimension = "minecraft:overworld";
|
||||||
@@ -32,12 +33,10 @@ in {
|
|||||||
};
|
};
|
||||||
ambient-light = 0.1;
|
ambient-light = 0.1;
|
||||||
cave-detection-ocean-floor = -5;
|
cave-detection-ocean-floor = -5;
|
||||||
marker-sets = {
|
|
||||||
_includes = [ (format.lib.mkInclude "${bluemap-export}/overworld.hocon") ];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
"underverden" = {
|
"underverden" = {
|
||||||
|
extraHoconMarkersFile = "${bluemap-export}/nether.hocon";
|
||||||
settings = {
|
settings = {
|
||||||
world = vanillaSurvival;
|
world = vanillaSurvival;
|
||||||
dimension = "minecraft:the_nether";
|
dimension = "minecraft:the_nether";
|
||||||
@@ -57,12 +56,10 @@ in {
|
|||||||
render-mask = [{
|
render-mask = [{
|
||||||
max-y = 90;
|
max-y = 90;
|
||||||
}];
|
}];
|
||||||
marker-sets = {
|
|
||||||
_includes = [ (format.lib.mkInclude "${bluemap-export}/nether.hocon") ];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
"enden" = {
|
"enden" = {
|
||||||
|
extraHoconMarkersFile = "${bluemap-export}/the-end.hocon";
|
||||||
settings = {
|
settings = {
|
||||||
world = vanillaSurvival;
|
world = vanillaSurvival;
|
||||||
dimension = "minecraft:the_end";
|
dimension = "minecraft:the_end";
|
||||||
@@ -78,9 +75,6 @@ in {
|
|||||||
ambient-light = 0.6;
|
ambient-light = 0.6;
|
||||||
remove-caves-below-y = -10000;
|
remove-caves-below-y = -10000;
|
||||||
cave-detection-ocean-floor = -5;
|
cave-detection-ocean-floor = -5;
|
||||||
marker-sets = {
|
|
||||||
_includes = [ (format.lib.mkInclude "${bluemap-export}/the-end.hocon") ];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -13,11 +13,32 @@ let
|
|||||||
(format.generate "${name}.conf" value))
|
(format.generate "${name}.conf" value))
|
||||||
cfg.storage);
|
cfg.storage);
|
||||||
|
|
||||||
mapsFolder = pkgs.linkFarm "maps"
|
generateMapConfigWithMarkerData = name: { extraHoconMarkersFile, settings, ... }:
|
||||||
(lib.attrsets.mapAttrs' (name: value:
|
assert (extraHoconMarkersFile == null) != ((settings.marker-sets or { }) == { });
|
||||||
lib.nameValuePair "${name}.conf"
|
lib.pipe settings (
|
||||||
(format.generate "${name}.conf" value.settings))
|
(lib.optionals (extraHoconMarkersFile != null) [
|
||||||
cfg.maps);
|
(settings: lib.recursiveUpdate settings {
|
||||||
|
marker-placeholder = "###ASDF###";
|
||||||
|
})
|
||||||
|
]) ++ [
|
||||||
|
(format.generate "${name}.conf")
|
||||||
|
] ++ (lib.optionals (extraHoconMarkersFile != null) [
|
||||||
|
(hoconFile: pkgs.runCommand "${name}-patched.conf" { } ''
|
||||||
|
mkdir -p "$(dirname "$out")"
|
||||||
|
cp '${hoconFile}' "$out"
|
||||||
|
substituteInPlace "$out" \
|
||||||
|
--replace-fail '"marker-placeholder" = "###ASDF###"' "\"marker-sets\" = $(cat '${extraHoconMarkersFile}')"
|
||||||
|
'')
|
||||||
|
])
|
||||||
|
);
|
||||||
|
|
||||||
|
mapsFolder = lib.pipe cfg.maps [
|
||||||
|
(lib.attrsets.mapAttrs' (name: value: {
|
||||||
|
name = "${name}.conf";
|
||||||
|
value = generateMapConfigWithMarkerData name value;
|
||||||
|
}))
|
||||||
|
(pkgs.linkFarm "maps")
|
||||||
|
];
|
||||||
|
|
||||||
webappConfigFolder = pkgs.linkFarm "bluemap-config" {
|
webappConfigFolder = pkgs.linkFarm "bluemap-config" {
|
||||||
"maps" = mapsFolder;
|
"maps" = mapsFolder;
|
||||||
@@ -30,7 +51,7 @@ let
|
|||||||
|
|
||||||
renderConfigFolder = name: value: pkgs.linkFarm "bluemap-${name}-config" {
|
renderConfigFolder = name: value: pkgs.linkFarm "bluemap-${name}-config" {
|
||||||
"maps" = pkgs.linkFarm "maps" {
|
"maps" = pkgs.linkFarm "maps" {
|
||||||
"${name}.conf" = (format.generate "${name}.conf" value.settings);
|
"${name}.conf" = generateMapConfigWithMarkerData name value;
|
||||||
};
|
};
|
||||||
"storages" = storageFolder;
|
"storages" = storageFolder;
|
||||||
"core.conf" = coreConfig;
|
"core.conf" = coreConfig;
|
||||||
@@ -160,6 +181,18 @@ in {
|
|||||||
defaultText = lib.literalExpression "config.services.bluemap.packs";
|
defaultText = lib.literalExpression "config.services.bluemap.packs";
|
||||||
description = "A set of resourcepacks, datapacks, and mods to extract resources from, loaded in alphabetical order.";
|
description = "A set of resourcepacks, datapacks, and mods to extract resources from, loaded in alphabetical order.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extraHoconMarkersFile = mkOption {
|
||||||
|
type = lib.types.nullOr lib.types.path;
|
||||||
|
default = null;
|
||||||
|
description = ''
|
||||||
|
Path to a hocon file containing marker data.
|
||||||
|
The content of this file will be injected into the map config file in a separate derivation.
|
||||||
|
|
||||||
|
DO NOT SEND THIS TO NIXPKGS, IT'S AN UGLY HACK.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
settings = mkOption {
|
settings = mkOption {
|
||||||
type = (lib.types.submodule {
|
type = (lib.types.submodule {
|
||||||
freeformType = format.type;
|
freeformType = format.type;
|
||||||
|
|||||||
Reference in New Issue
Block a user