diff options
Diffstat (limited to 'guix/vkraus/services')
-rw-r--r-- | guix/vkraus/services/webid-oidc.scm | 87 |
1 files changed, 77 insertions, 10 deletions
diff --git a/guix/vkraus/services/webid-oidc.scm b/guix/vkraus/services/webid-oidc.scm index 4c7834c..931e96a 100644 --- a/guix/vkraus/services/webid-oidc.scm +++ b/guix/vkraus/services/webid-oidc.scm @@ -31,6 +31,17 @@ webid-oidc-issuer-configuration-extra-options (default '()))) +(define-record-type* <webid-oidc-hello-configuration> + webid-oidc-hello-configuration + make-webid-oidc-hello-configuration + webid-oidc-hello-configuration? + (webid-oidc webid-oidc-hello-configuration-webid-oidc + (default webid-oidc)) + (port webid-oidc-hello-configuration-port (default 8089)) + (extra-options + webid-oidc-hello-configuration-extra-options + (default '()))) + (export <webid-oidc-issuer-configuration> webid-oidc-issuer-configuration make-webid-oidc-issuer-configuration @@ -44,7 +55,13 @@ webid-oidc-issuer-configuration-authorization-endpoint-uri webid-oidc-issuer-configuration-token-endpoint-uri webid-oidc-issuer-configuration-port - webid-oidc-issuer-configuration-extra-options) + webid-oidc-issuer-configuration-extra-options + webid-oidc-hello-configuration + make-webid-oidc-hello-configuration + webid-oidc-hello-configuration? + webid-oidc-hello-configuration-webid-oidc + webid-oidc-hello-configuration-port + webid-oidc-hello-configuration-extra-options) (define webid-oidc-issuer-shepherd-service (match-lambda @@ -64,7 +81,7 @@ (gnu system file-systems))) (start #~(begin - (let* ((user (getpwnam "webid-oidc-issuer")) + (let* ((user (getpwnam "webid-oidc")) (prepare-directory (lambda (dir) (mkdir-p dir) @@ -87,8 +104,8 @@ "--log-file" "issuer.log" "--error-file" "issuer.err" #$@extra-options) - #:user "webid-oidc-issuer" - #:group "webid-oidc-issuer" + #:user "webid-oidc" + #:group "webid-oidc" #:directory "/var/log/webid-oidc" #:environment-variables `("XDG_DATA_HOME=/var/lib" @@ -96,14 +113,53 @@ "LANG=C")))) (stop #~(make-kill-destructor)))))))) -(define %webid-oidc-issuer-accounts - (list (user-group (name "webid-oidc-issuer") +(define webid-oidc-hello-shepherd-service + (match-lambda + (($ <webid-oidc-hello-configuration> + webid-oidc port extra-options) + (with-imported-modules + (source-module-closure + '((gnu build shepherd) + (gnu system file-systems))) + (list (shepherd-service + (provision '(webid-oidc-hello)) + (documentation "Run a demonstration Solid server.") + (requirement '(user-processes)) + (modules '((gnu build shepherd) + (gnu system file-systems))) + (start + #~(begin + (let* ((user (getpwnam "webid-oidc")) + (prepare-directory + (lambda (dir) + (mkdir-p dir) + (chown dir (passwd:uid user) (passwd:gid user)) + (chmod dir #o700)))) + (prepare-directory "/var/log/webid-oidc") + (prepare-directory "/var/lib/webid-oidc") + (prepare-directory "/var/cache/webid-oidc")) + (make-forkexec-constructor + (list + (string-append #$webid-oidc "/bin/webid-oidc-hello") + "--port" (with-output-to-string (lambda () (display #$port))) + #$@extra-options) + #:user "webid-oidc" + #:group "webid-oidc" + #:directory "/var/log/webid-oidc" + #:environment-variables + `("XDG_DATA_HOME=/var/lib" + "XDG_CACHE_HOME=/var/cache" + "LANG=C")))) + (stop #~(make-kill-destructor)))))))) + +(define %webid-oidc-accounts + (list (user-group (name "webid-oidc") (system? #t)) (user-account - (name "webid-oidc-issuer") - (group "webid-oidc-issuer") + (name "webid-oidc") + (group "webid-oidc") (system? #t) - (comment "The user that runs the webid-oidc issuer.") + (comment "The user that runs the webid-oidc issuer and resource server.") (home-directory "/var/empty") (shell (file-append shadow "/sbin/nologin"))))) @@ -113,7 +169,18 @@ (extensions (list (service-extension account-service-type - (const %webid-oidc-issuer-accounts)) + (const %webid-oidc-accounts)) (service-extension shepherd-root-service-type webid-oidc-issuer-shepherd-service))))) + +(define-public webid-oidc-hello-service-type + (service-type + (name 'webid-oidc-hello) + (extensions + (list + (service-extension account-service-type + (const %webid-oidc-accounts)) + (service-extension + shepherd-root-service-type + webid-oidc-hello-shepherd-service))))) |