path: root/doc/contributing.texi
diff options
context:
space:
mode:
Diffstat (limited to 'doc/contributing.texi')
0 files changed, 0 insertions, 0 deletions
epherd home-shepherd-configuration-shepherd (default shepherd-1.0)) ;package (auto-start? home-shepherd-configuration-auto-start? (default #t)) (daemonize? home-shepherd-configuration-daemonize? (default #t)) (silent? home-shepherd-configuration-silent? (default #t)) (services home-shepherd-configuration-services (default '()))) (define (home-shepherd-configuration-file config) "Return the shepherd configuration file for SERVICES. SHEPHERD is used as shepherd package." (let* ((daemonize? (home-shepherd-configuration-daemonize? config)) (services (home-shepherd-configuration-services config)) (_ (assert-valid-graph services)) (files (map shepherd-service-file services)) ;; TODO: Add compilation of services, it can improve start ;; time. ;; (scm->go (cute scm->go <> shepherd)) ) (define config #~(begin (use-modules (srfi srfi-34) (system repl error-handling)) (define (make-user-module) ;; Copied from (shepherd support), where it's private. (let ((m (make-fresh-user-module))) (module-use! m (resolve-interface '(shepherd service))) m)) (register-services (map (lambda (file) (save-module-excursion (lambda () (set-current-module (make-user-module)) (load file)))) '#$files)) #$(and daemonize? #~(perform-service-action root-service 'daemonize)) (format #t "Starting services...~%") (let ((services-to-start '#$(append-map shepherd-service-provision (filter shepherd-service-auto-start? services)))) (start-in-the-background services-to-start) (redirect-port (open-input-file "/dev/null") (current-input-port))))) (scheme-file "shepherd.conf" config))) (define (launch-shepherd-gexp config) (let* ((shepherd (home-shepherd-configuration-shepherd config)) (silent? (home-shepherd-configuration-silent? config))) (if (home-shepherd-configuration-auto-start? config) (with-imported-modules '((guix build utils)) #~(unless (file-exists? (string-append (or (getenv "XDG_RUNTIME_DIR") (format #f "/run/user/~a" (getuid))) "/shepherd/socket")) (system* #$(file-append shepherd "/bin/shepherd") #$@(if silent? '("--silent") '()) "--config" #$(home-shepherd-configuration-file config)))) #~""))) (define (reload-configuration-gexp config) (let* ((shepherd (home-shepherd-configuration-shepherd config))) #~(system* #$(file-append shepherd "/bin/herd") "load" "root" #$(home-shepherd-configuration-file config)))) (define (ensure-shepherd-gexp config) #~(if (file-exists? (string-append (or (getenv "XDG_RUNTIME_DIR") (format #f "/run/user/~a" (getuid))) "/shepherd/socket")) #$(reload-configuration-gexp config) ;; Don't attempt to start user shepherd if the system is running the ;; activation script. /run/user/<uid> may not have been created ;; yet. But do otherwise so if the runtime dir does not exist an error ;; is logged. (unless (getenv "GUIX_SYSTEM_IS_RUNNING_HOME_ACTIVATE") #$(launch-shepherd-gexp config)))) (define (shepherd-xdg-configuration-files config) `(("shepherd/init.scm" ,(home-shepherd-configuration-file config)))) (define home-shepherd-service-type (service-type (name 'home-shepherd) (extensions (list (service-extension home-run-on-first-login-service-type launch-shepherd-gexp) (service-extension home-xdg-configuration-files-service-type shepherd-xdg-configuration-files) (service-extension home-activation-service-type ensure-shepherd-gexp) (service-extension home-profile-service-type (lambda (config) `(,(home-shepherd-configuration-shepherd config)))))) (compose concatenate) (extend (lambda (config extra-services) (home-shepherd-configuration (inherit config) (services (append (home-shepherd-configuration-services config) extra-services))))) (default-value (home-shepherd-configuration)) (description "Configure and install userland Shepherd."))) (define-service-type-mapping shepherd-root-service-type => home-shepherd-service-type) ;;; ;;; Timer and transient service maker. ;;; (define home-shepherd-timer-service-type (service-type (inherit (system->home-service-type shepherd-timer-service-type)) (default-value '()))) ;requirement (define home-shepherd-transient-service-type (service-type (inherit (system->home-service-type shepherd-transient-service-type)) (default-value '()))) ;requirement