commit 76f9e9f4e654940a0ba536bae34f2d39f9417225
parent a15c872f09b0d54f866e7d4a1272608a6dbaa460
Author: Luke Willis <lukejw@monastech.xyz>
Date:   Wed,  6 May 2026 13:34:09 -0400

services: Allow setting server.properties values for minecraft-service-type

Diffstat:
Mmt/services/games.scm | 18+++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/mt/services/games.scm b/mt/services/games.scm @@ -55,6 +55,8 @@ (default %default-fabric-jar)) (memory minecraft-configuration-memory (default 8)) + (properties minecraft-configuration-properties + (default '())) (mods minecraft-configuration-mods (default '())) (log-file minecraft-configuration-log-file @@ -81,7 +83,7 @@ (define minecraft-activation (match-lambda - (($ <minecraft-configuration> jdk jar memory mods log-file home port) + (($ <minecraft-configuration> jdk jar memory properties mods log-file home port) (with-imported-modules '((guix build utils)) #~(begin (use-modules (guix build utils) @@ -89,6 +91,7 @@ (let ((user (getpwnam "minecraft")) (eula #$(string-append home "/eula.txt")) + (properties #$(string-append home "/server.properties")) (mod-dir #$(string-append home "/mods/"))) ;; TODO: Setup files as the root user ;; Setup files as the git user. @@ -105,7 +108,16 @@ (if (not (file-exists? eula)) (symlink #$%minecraft-eula eula)) - ;; TODO: server.properties + ;; Write to server.properties. + (call-with-output-file + properties + (lambda (port) + (for-each + (lambda (pair) + (format port "~a=~a\n" (car pair) (cdr pair))) + #$properties))) + + ;; TODO: Mod config ;; Symlink mods to the mods folder. (if (file-exists? mod-dir) @@ -127,7 +139,7 @@ (define minecraft-shepherd-service (match-lambda - (($ <minecraft-configuration> jdk jar memory mods log-file home port) + (($ <minecraft-configuration> jdk jar memory properties mods log-file home port) (shepherd-service (documentation "Minecraft server") (provision '(minecraft))