commit 6a3ad9ffdf6e8668efdd1dfc379cedfaed6c38d3
parent d6c713cec5dffeadaa04b0114b33ceba87238a09
Author: Luke Willis <lukejw@loquat.dev>
Date: Thu, 14 May 2026 02:49:50 -0400
bta: Add times mod and mod config support
Diffstat:
2 files changed, 109 insertions(+), 8 deletions(-)
diff --git a/system/andrew.scm b/system/andrew.scm
@@ -96,7 +96,81 @@ table inet filter {
(sha256 (base32 "01v14b7r0b95idjqimqa0q3wdyzqmyi3j03bw3n8jpbsqzni613n")))
(minecraft-mod
(url "https://cdn.modrinth.com/data/wKkoqHrH/versions/q4Pg0AcC/Geyser-Fabric-2.10.0-b1138.jar")
- (sha256 (base32 "1j1gs3kpnp4wfa8sj9s7j3c4aqx4cn33pqcfwz3iska88k54h88i")))
+ (sha256 (base32 "1j1gs3kpnp4wfa8sj9s7j3c4aqx4cn33pqcfwz3iska88k54h88i"))
+ (config (plain-file "config.yml"
+ "\
+bedrock:
+ address: 0.0.0.0
+ port: 19132
+ clone-remote-port: false
+
+java:
+ auth-type: floodgate
+
+# MOTD settings
+motd:
+ primary-motd: Geyser
+ secondary-motd: Another Geyser server.
+ passthrough-motd: true
+ max-players: 100
+ passthrough-player-counts: true
+ integrated-ping-passthrough: true
+ ping-passthrough-interval: 3
+
+gameplay:
+ server-name: Geyser
+ cooldown-type: crosshair
+ command-suggestions: true
+ show-coordinates: true
+ disable-bedrock-scaffolding: false
+ nether-roof-workaround: false
+ emotes-enabled: true
+ block-legacy-codes: true
+ unusable-space-block: minecraft:barrier
+ enable-custom-content: true
+ force-resource-packs: true
+ enable-integrated-pack: true
+ forward-player-ping: false
+ xbox-achievements-enabled: false
+ max-visible-custom-skulls: 128
+ custom-skull-render-distance: 32
+
+default-locale: system
+log-player-ip-addresses: true
+
+saved-user-logins:
+ - ThisExampleUsernameShouldBeLongEnoughToNeverBeAnXboxUsername
+ - ThisOtherExampleUsernameShouldAlsoBeLongEnough
+
+pending-authentication-timeout: 120
+notify-on-new-bedrock-update: true
+
+advanced:
+ cache-images: 0
+ scoreboard-packet-threshold: 20
+ add-team-suggestions: true
+ resource-pack-urls: []
+ floodgate-key-file: key.pem
+
+ java:
+ use-haproxy-protocol: false
+ use-direct-connection: true
+ disable-compression: true
+
+ bedrock:
+ broadcast-port: 0
+ compression-level: 6
+ use-haproxy-protocol: false
+ haproxy-protocol-whitelisted-ips: []
+ use-waterdogpe-forwarding: false
+ mtu: 1400
+ validate-bedrock-login: true
+
+enable-metrics: false
+debug-mode: false
+config-version: 7
+"))
+ (config-subdir "Geyser-Fabric"))
(minecraft-mod
(url "https://cdn.modrinth.com/data/bWrNNfkb/versions/fD4J9lnX/Floodgate-Fabric-2.2.6-b63.jar")
(sha256 (base32 "0bazalawy2md8x1q51vgns4p9847k0bgcs4pnnhvbnp53wljpapl")))
@@ -150,6 +224,7 @@ table inet filter {
(service minecraft-service-type
(minecraft-configuration
(properties `(("motd" . "HolyCross SMP - CHADS ONLY")
+ ("level-seed" . "-3181141381111340746")
("difficulty" . "hard")
("allow-flight" . "true")
("white-list" . "true")
diff --git a/system/andrew/minecraft.scm b/system/andrew/minecraft.scm
@@ -34,7 +34,9 @@
(url minecraft-mod-url)
(sha256 minecraft-mod-sha256)
(config minecraft-mod-config
- (default #f)))
+ (default #f))
+ (config-subdir minecraft-mod-config-subdir
+ (default #f)))
(define (minecraft-mod->origin mod)
(origin
@@ -85,8 +87,23 @@
(define minecraft-activation
(match-lambda
(($ <minecraft-configuration> jdk memory properties mods home log-file)
- (let* ((mod-files (map minecraft-mod->origin mods))
- (mod-config-files (filter-map minecraft-mod-config mods)))
+ (let ((mod-files (map minecraft-mod->origin mods))
+ (mod-config-files (filter-map minecraft-mod-config mods))
+ (mod-config-subdirs
+ (map
+ (lambda (mod)
+ (let ((subdir (minecraft-mod-config-subdir mod)))
+ (if (not subdir)
+ #f
+ (if (string-prefix? "/" subdir)
+ subdir
+ (string-append "/" subdir)))))
+ (filter-map
+ (lambda (mod)
+ (if (not (minecraft-mod-config mod))
+ #f
+ mod))
+ mods))))
(with-imported-modules '((guix build utils))
#~(begin
(use-modules (guix build utils)
@@ -97,6 +114,11 @@
(delete-file-recursively dir))
(mkdir dir))
+ (define (resymlink in out)
+ (when (file-exists? out)
+ (delete-file out))
+ (symlink in out))
+
(let ((user (getpwnam "minecraft"))
(eula-txt
#$(string-append home "/eula.txt"))
@@ -133,7 +155,6 @@
(lambda (pair)
(format port "~a=~a\n" (car pair) (cdr pair)))
'#$properties)))
-
;; Link mods
(remkdir mod-dir)
(for-each
@@ -146,11 +167,16 @@
;; Link configs
(remkdir config-dir)
(for-each
- (lambda (config)
+ (lambda (config subdir)
+ ;; Make subdir if not #f
+ (unless (not subdir)
+ (mkdir-p (string-append config-dir subdir)))
+ ;; Link config to dir
(symlink config
- (string-append config-dir "/"
+ (string-append config-dir (or subdir "") "/"
(string-drop (basename config) 33))))
- '#$mod-config-files)
+ '#$mod-config-files
+ '#$mod-config-subdirs)
;; Return to main thread
(primitive-exit 0))