diff options
Diffstat (limited to 'gnu/services')
-rw-r--r-- | gnu/services/base.scm | 16 | ||||
-rw-r--r-- | gnu/services/networking.scm | 86 |
2 files changed, 58 insertions, 44 deletions
diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 5298a11f63..dad1911d31 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -274,7 +274,8 @@ FILE-SYSTEM." (options (file-system-options file-system)) (check? (file-system-check? file-system)) (create? (file-system-create-mount-point? file-system)) - (dependencies (file-system-dependencies file-system))) + (dependencies (file-system-dependencies file-system)) + (packages (file-system-packages (list file-system)))) (and (file-system-mount? file-system) (with-imported-modules '((gnu build file-systems) (guix build bournish)) @@ -284,7 +285,7 @@ FILE-SYSTEM." ,@(map dependency->shepherd-service-name dependencies))) (documentation "Check, mount, and unmount the given file system.") (start #~(lambda args - #$(if create? + #$(if create? #~(mkdir-p #$target) #t) @@ -292,11 +293,12 @@ FILE-SYSTEM." ;; Make sure fsck.ext2 & co. can be found. (dynamic-wind (lambda () - (setenv "PATH" - (string-append - #$e2fsprogs "/sbin:" - "/run/current-system/profile/sbin:" - $PATH))) + ;; Don’t display the PATH settings. + (with-output-to-port (%make-void-port "w") + (lambda () + (set-path-environment-variable "PATH" + '("bin" "sbin") + '#$packages)))) (lambda () (mount-file-system `(#$device #$title #$target #$type #$flags diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm index 18bce2a2b8..9b8e5b36b1 100644 --- a/gnu/services/networking.scm +++ b/gnu/services/networking.scm @@ -80,7 +80,10 @@ network-manager-configuration-dns network-manager-service-type - connman-service + connman-configuration + connman-configuration? + connman-service-type + wpa-supplicant-service-type openvswitch-service-type @@ -822,45 +825,54 @@ dns=" dns " ;;; Connman ;;; -(define %connman-activation - ;; Activation gexp for Connman. - #~(begin - (use-modules (guix build utils)) - (mkdir-p "/var/lib/connman/") - (mkdir-p "/var/lib/connman-vpn/"))) - -(define (connman-shepherd-service connman) +(define-record-type* <connman-configuration> + connman-configuration make-connman-configuration + connman-configuration? + (connman connman-configuration-connman + (default connman)) + (disable-vpn? connman-configuration-disable-vpn? + (default #f))) + +(define (connman-activation config) + (let ((disable-vpn? (connman-configuration-disable-vpn? config))) + (with-imported-modules '((guix build utils)) + #~(begin + (use-modules (guix build utils)) + (mkdir-p "/var/lib/connman/") + (unless #$disable-vpn? + (mkdir-p "/var/lib/connman-vpn/")))))) + +(define (connman-shepherd-service config) "Return a shepherd service for Connman" - (list (shepherd-service - (documentation "Run Connman") - (provision '(networking)) - (requirement '(user-processes dbus-system loopback wpa-supplicant)) - (start #~(make-forkexec-constructor - (list (string-append #$connman - "/sbin/connmand") - "-n" "-r"))) - (stop #~(make-kill-destructor))))) + (and + (connman-configuration? config) + (let ((connman (connman-configuration-connman config)) + (disable-vpn? (connman-configuration-disable-vpn? config))) + (list (shepherd-service + (documentation "Run Connman") + (provision '(networking)) + (requirement + '(user-processes dbus-system loopback wpa-supplicant)) + (start #~(make-forkexec-constructor + (list (string-append #$connman + "/sbin/connmand") + "-n" "-r" + #$@(if disable-vpn? '("--noplugin=vpn") '())))) + (stop #~(make-kill-destructor))))))) (define connman-service-type - (service-type (name 'connman) - (extensions - (list (service-extension shepherd-root-service-type - connman-shepherd-service) - (service-extension dbus-root-service-type list) - (service-extension activation-service-type - (const %connman-activation)) - ;; Add connman to the system profile. - (service-extension profile-service-type list))))) - -(define* (connman-service #:key (connman connman)) - "Return a service that runs @url{https://01.org/connman,Connman}, a network -connection manager. - -This service adds the @var{connman} package to the global profile, providing -several the @command{connmanctl} command to interact with the daemon and -configure networking." - (service connman-service-type connman)) - + (let ((connman-package (compose list connman-configuration-connman))) + (service-type (name 'connman) + (extensions + (list (service-extension shepherd-root-service-type + connman-shepherd-service) + (service-extension dbus-root-service-type + connman-package) + (service-extension activation-service-type + connman-activation) + ;; Add connman to the system profile. + (service-extension profile-service-type + connman-package)))))) ;;; |