diff options
author | Franz Geffke <franz@pantherx.org> | 2023-11-06 20:08:14 +0000 |
---|---|---|
committer | Franz Geffke <franz@pantherx.org> | 2023-11-06 20:08:14 +0000 |
commit | 47b4c9c854915df93893dbaa993accfacf9027fe (patch) | |
tree | 4f9b1742d63fcfbc94cc6b8d84f76c4d00c3a0b7 /px/services/server.scm | |
parent | 0b426d7b7ed8e176bf464ef9e0683f74a6c9d20f (diff) |
rewrite: apply guix-reference formatting; cleanup some module imports
Diffstat (limited to 'px/services/server.scm')
-rw-r--r-- | px/services/server.scm | 112 |
1 files changed, 65 insertions, 47 deletions
diff --git a/px/services/server.scm b/px/services/server.scm index acb721b..7f4d5c7 100644 --- a/px/services/server.scm +++ b/px/services/server.scm @@ -6,71 +6,89 @@ #:use-module (guix gexp) #:use-module (guix records) #:use-module (ice-9 match) - #:export (px-server-launcher-configuration - px-server-launcher-service-type)) - + #:export (px-server-launcher-configuration px-server-launcher-service-type)) ;;; ;;; PantherX Server Launcher Service ;;; (define-record-type* <px-server-launcher-configuration> - px-server-launcher-configuration make-px-server-launcher-configuration + px-server-launcher-configuration + make-px-server-launcher-configuration px-server-launcher-configuration? - (user px-server-launcher-configuration-user - (default "panther")) - (group px-server-launcher-configuration-group - (default "users")) + (user px-server-launcher-configuration-user + (default "panther")) + (group px-server-launcher-configuration-group + (default "users")) (executable px-server-launcher-configuration-executable) - (args px-server-launcher-configuration-args - (default '())) - (cwd px-server-launcher-configuration-cwd - (default #f))) - + (args px-server-launcher-configuration-args + (default '())) + (cwd px-server-launcher-configuration-cwd + (default #f))) (define (px-server-launcher->script config) (match config - (($ <px-server-launcher-configuration> user group executable args cwd) + (($ <px-server-launcher-configuration> + user + group + executable + args + cwd) (plain-file "px-server-launcher" (string-append "#!/bin/sh\n\n" - "export PATH=$HOME/.local/bin:$PATH\n" ;; add user installed binaries to PATH - (if cwd (string-append "cd " cwd "\n") "") - "exec " executable " " (string-join args " ") "\n"))))) - + "export PATH=$HOME/.local/bin:$PATH\n" ;add user installed binaries to PATH + (if cwd + (string-append "cd " cwd "\n") "") + "exec " + executable + " " + (string-join args " ") + "\n"))))) (define (px-server-launcher-shepherd-service config) (match config - (($ <px-server-launcher-configuration> user group executable args cwd) - (let* ((home-dir (if (eq? user "root") - "/root" + (($ <px-server-launcher-configuration> + user + group + executable + args + cwd) + (let* ((home-dir (if (eq? user "root") "/root" (string-append "/home/" user))) (script (px-server-launcher->script config))) - (list (shepherd-service - (provision '(px-server-launcher)) - (documentation "PantherX Server Application Launcher Service") - (requirement '(networking user-processes)) - (one-shot? #t) - (start #~(make-forkexec-constructor - (list (string-append #$bash "/bin/bash") - #$script) - #:user #$user - #:group #$group - #:environment-variables - (cons* (string-append "HOME=" #$home-dir) - (string-append "PATH=/run/current-system/profile/bin") - (string-append "XDG_DATA_HOME=" #$home-dir "/.local/share") - (string-append "XDG_CONFIG_HOME=" #$home-dir "/.config") - "SSL_CERT_DIR=/run/current-system/profile/etc/ssl/certs" - "SSL_CERT_FILE=/run/current-system/profile/etc/ssl/certs/ca-certificates.crt" - (default-environment-variables)) - #:log-file "/var/log/px-server-launcher.log")) - (stop #~(make-kill-destructor)))))))) - + (list (shepherd-service (provision '(px-server-launcher)) + (documentation + "PantherX Server Application Launcher Service") + (requirement '(networking user-processes)) + (one-shot? #t) + (start #~(make-forkexec-constructor (list (string-append #$bash + "/bin/bash") + #$script) + #:user #$user + #:group #$group + #:environment-variables (cons* (string-append + "HOME=" + #$home-dir) + (string-append + "PATH=/run/current-system/profile/bin") + (string-append + "XDG_DATA_HOME=" + #$home-dir + "/.local/share") + (string-append + "XDG_CONFIG_HOME=" + #$home-dir + "/.config") + "SSL_CERT_DIR=/run/current-system/profile/etc/ssl/certs" + "SSL_CERT_FILE=/run/current-system/profile/etc/ssl/certs/ca-certificates.crt" + (default-environment-variables)) + #:log-file + "/var/log/px-server-launcher.log")) + (stop #~(make-kill-destructor)))))))) (define px-server-launcher-service-type - (service-type - (name 'px-server-launcher) - (description "PantherX Server Application Launcher Service") - (extensions (list - (service-extension shepherd-root-service-type + (service-type (name 'px-server-launcher) + (description "PantherX Server Application Launcher Service") + (extensions (list (service-extension + shepherd-root-service-type px-server-launcher-shepherd-service))))) |