commit a88c19104988fdcec10f019fdac11b9879c547a3
parent 25f19bf40d2727a42cf284d677bbbbb9b80119cd
Author: Luke Willis <lukejw@loquat.dev>
Date: Wed, 13 May 2026 16:53:53 -0400
bta: Add times mod and mod config support
Diffstat:
2 files changed, 67 insertions(+), 23 deletions(-)
diff --git a/system/andrew.scm b/system/andrew.scm
@@ -111,11 +111,9 @@ table inet filter {
(display-name "Breeding")
(url "https://github.com/UselessSolutions/bta-breeding-backport/releases/download/v1.1.0-7.3/btabreeding-1.1.0-7.3.jar")
(sha256 (base32 "1l3jwc4q1ygv31v19c50y1j1gvsfq286i0k9ndhpmbbdjhlab1cw")))
- (bta-mod
- (name "times")
- (display-name "Times")
- (url "https://github.com/solignomiki/bta-times/releases/download/1.2.1-7.3/times-1.2.1-7.3.jar")
- (sha256 (base32 "1682g5c3ciszpyl7l2qif813dn21ianha3wa529488xzga42qhlb")))
+ (bta-mod-times
+ (bta-times-configuration
+ (realtime #t)))
;; Optional mods
(bta-mod
(name "btwaila")
diff --git a/system/andrew/bta.scm b/system/andrew/bta.scm
@@ -17,19 +17,65 @@
#:use-module (guix build-system copy)
#:use-module (mt utils)
#:use-module (mt packages games)
+ #:use-module ((srfi srfi-1) #:select (filter-map))
#:use-module (ice-9 match)
#:export (bta-mod
bta-mod?
+ bta-times-configuration
+ bta-times-configuration?
+ bta-mod-times
bta-configuration
bta-configuration?
bta-service-type))
-;; TODO: Grand BTA service w/ unsup setup
-
-;; 1. Must setup actual server service (already done)
-;; 2. Must build packwiz configuration
-;; 3. Must serve packwiz configuration over https
-;; 4. Must build PrismLauncher instance
+;; Mod helper records
+(define-record-type* <bta-mod>
+ bta-mod
+ make-bta-mod
+ bta-mod?
+ (name bta-mod-name)
+ (display-name bta-mod-display-name)
+ (url bta-mod-url)
+ (sha256 bta-mod-sha256)
+ (optional bta-mod-optional
+ (default #f))
+ (description bta-mod-description
+ (default "No description..."))
+ (server-config bta-mod-server-config
+ (default #f)))
+
+(define-record-type* <bta-times-configuration>
+ bta-times-configuration
+ make-bta-times-configuration
+ bta-times-configuration?
+ (realtime bta-times-configuration-realtime
+ (default #t)))
+
+(define (bta-mod-times configuration)
+ (bta-mod
+ (name "times")
+ (display-name "Times")
+ (url "https://files.monastech.xyz/times-1.2.0-7.3_SLEEPFIX.jar")
+ (sha256 (base32 "09if4mcd4nx9jkvrbgqqbv95ql74gw3nh3xsywsyir0p25ah7rz1"))
+ (description "Modifies the cycle of seasons.")
+ (server-config
+ (let ((realtime? (bta-times-configuration-realtime configuration)))
+ (mixed-text-file "times.cfg"
+ "Mode = \"" (if realtime? "REALTIME" "LENGTH") "\"\n"
+ ;; TODO: Configure rest of this
+ "TurnOffSleep = \"" "false" "\n"
+ "MinecraftDayLength = " "24000" "\n"
+ "\n"
+ "[LENGTH]\n"
+ "\tSpringLength = " "28" "\n"
+ "\tSummerLength = " "28" "\n"
+ "\tFallLength = " "28" "\n"
+ "\tWinterLength = " "28" "\n"
+ "\n"
+ "[REALTIME]\n"
+ "\tHemisphere = \"" "NORTHERN" "\"\n")))))
+
+;; Main code
(define %unsup-jar
(origin
@@ -97,18 +143,6 @@
(log-file bta-configuration-log-file
(default "/var/log/bta.log")))
-(define-record-type* <bta-mod>
- bta-mod
- make-bta-mod
- bta-mod?
- (name bta-mod-name)
- (display-name bta-mod-display-name)
- (url bta-mod-url)
- (sha256 bta-mod-sha256)
- (optional bta-mod-optional
- (default #f))
- (description bta-mod-description
- (default "No description...")))
(define bta-activation-rewrite
(match-lambda
@@ -268,6 +302,8 @@ hash = \"~a\"
(bytevector->base16-string
(file-sha256 #$packwiz-index))))))))))
;; SERVER STUFF
+ (mod-server-config-files
+ (filter-map bta-mod-server-config mods))
(server-launcher-properties
(mixed-text-file "fabric-server-launcher.properties"
"serverJar="
@@ -294,6 +330,8 @@ hash = \"~a\"
#$(string-append packwiz-home "/mods"))
(server-mod-dir
#$(string-append home "/mods"))
+ (server-config-dir
+ #$(string-append home "/config"))
(server-launcher-properties
#$(string-append home "/fabric-server-launcher.properties"))
(server-properties
@@ -368,6 +406,14 @@ hash = \"~a\"
(string-append server-mod-dir "/"
(string-drop (basename mod) 33))))
'#$mod-files)
+
+ (remkdir server-config-dir)
+ (for-each
+ (lambda (config)
+ (copy-file config
+ (string-append server-config-dir "/"
+ (string-drop (basename config) 33))))
+ '#$mod-server-config-files)
;; Return to main thread
(primitive-exit 0))