dev.fron.io rc / 5a5b865
system(delta): add crude minecraft server Tony Olagbaiye a month ago
3 changed file(s) with 30 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
4141 ;; TODO: replace this with lisp (use install-jars, etc)
4242 (let ((port (open-file (string-append output "/bin/minecraft-server") "a")))
4343 (display (string-append "#!" (string-append bash "/bin/sh") "\n") port)
44 (display (string-append "exec -a minecraft-server "
44 (display (string-append "exec "
4545 (string-append openjdk "/bin/java ")
4646 "-jar "
4747 "$@ "
4343 ;; TODO: replace this with lisp (use install-jars, etc)
4444 (let ((port (open-file (string-append output "/bin/minecraft-server") "a")))
4545 (display (string-append "#!" (string-append bash "/bin/sh") "\n") port)
46 (display (string-append "exec -a minecraft-server "
46 (display (string-append "exec "
4747 (string-append openjdk "/bin/java ")
4848 "$@ "
4949 "-jar "
4646 #:use-module (gnu packages irc)
4747 #:use-module (nongnu packages linux)
4848 #:use-module (rc packages biboumi)
49 #:use-module (rc packages minecraft)
4950 #:use-module (rc packages nix)
5051 #:use-module (rc packages pipewire)
5152 #:use-module (rc packages xmpppy)
146147 (home-directory "/home/python")
147148 (shell "/home/python/.guix-profile/bin/python")
148149 (supplementary-groups '()))
150 (user-account
151 (name "minecraft")
152 (group "games")
153 (home-directory "/var/lib/minecraft"))
149154 %base-user-accounts))
150155
151156 (groups (cons* (user-group
157 (name "games")
158 (system? #t))
159 (user-group
152160 (name "adbusers")
153161 (system? #f))
154162 (user-group
321329 pipewire-next)
322330 (udev-rules-service 'android-add-udev-rules
323331 android-udev-rules)
332 (simple-service 'minecraft-server shepherd-root-service-type
333 (list (shepherd-service
334 (documentation "Minecraft Server.")
335 (provision '(minecraft))
336 (requirement '(networking))
337 (start #~(lambda _
338 (let ((mc (string-append #$minecraft-server
339 "/bin/minecraft-server"))
340 (user (getpwnam "minecraft")))
341 (mkdir-p "/var/lib/minecraft")
342 (chmod "/var/lib/minecraft" #o755)
343 (chown "/var/lib/minecraft"
344 (passwd:uid user) (passwd:gid user))
345 (chdir "/var/lib/minecraft")
346 ;; /nix/store/41zy3hnpbd1rnfxc72h7mb1xjj78rh3i-unit-script-minecraft-server-pre-start/bin/minecraft-server-pre-start
347 ;; -> https://gateway.ipfs.io/ipfs/QmbzcDZzxFDggQcKNGwRCDQvVqZovUvVDMq6nnMbYjboZs
348 (fork+exec-command
349 (list mc "-Xmx2048M" "-Xms2048M")
350 #:user (passwd:uid user)
351 #:group (passwd:gid user))))))))
324352 (simple-service 'no-eth shepherd-root-service-type
325353 (list (shepherd-service
326354 (documentation "Set enp4s0u1 link down.")