services: iwd-service-type: Fix build issue.

* rosenthal/services/networking.scm (iwd-shepherd-service,iwd-etc-service):
Switch back to `match-lambda`.
(iwd-configuration,iwd-service-type): Add description.
wip/index/refs/heads/trunk
Hilton Chain 2 years ago
parent abeacc8731
commit f96276ca08
No known key found for this signature in database
GPG Key ID: 5E5AA665614917F7
  1. 74
      rosenthal/services/networking.scm

@ -3,30 +3,18 @@
;; SPDX-License-Identifier: BSD-3-Clause ;; SPDX-License-Identifier: BSD-3-Clause
(define-module (rosenthal services networking) (define-module (rosenthal services networking)
#:use-module (ice-9 ftw)
#:use-module (ice-9 match) #:use-module (ice-9 match)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
#:use-module (guix gexp) #:use-module (guix gexp)
#:use-module (guix store)
#:use-module (guix monads)
#:use-module (guix records)
#:use-module (guix packages)
#:use-module (guix import utils) #:use-module (guix import utils)
#:use-module (guix packages)
#:use-module (gnu packages dns) #:use-module (gnu packages dns)
#:use-module (gnu packages base) #:use-module (gnu packages base)
#:use-module (gnu packages connman)
#:use-module (gnu packages networking) #:use-module (gnu packages networking)
#:use-module (gnu services) #:use-module (gnu services)
#:use-module (gnu services dbus) #:use-module (gnu services dbus)
#:use-module (gnu services base) #:use-module (gnu services base)
#:use-module (gnu services shepherd) #:use-module (gnu services shepherd)
#:use-module (gnu services configuration) #:use-module (gnu services configuration)
#:use-module ((rosenthal utils home-services-utils) #:use-module ((rosenthal utils home-services-utils)
#:select (ini-config? #:select (ini-config?
maybe-object->string maybe-object->string
@ -53,36 +41,40 @@
#:fields config)) #:fields config))
(define-configuration/no-serialization iwd-configuration (define-configuration/no-serialization iwd-configuration
(package (package iwd) "") (iwd
(config (ini-config '()) "")) (package iwd)
"The iwd package.")
(config
(ini-config '())
"Association list of iwd configurations."))
(define (iwd-shepherd-service config) (define iwd-shepherd-service
(match-record config <iwd-configuration> (match-lambda
(package) (($ <iwd-configuration> iwd _)
(let ((environment #~(list (string-append (let ((environment #~(list (string-append
"PATH=" "PATH="
(string-append #$openresolv "/sbin") (string-append #$openresolv "/sbin")
":" ":"
(string-append #$coreutils "/bin"))))) (string-append #$coreutils "/bin")))))
(list (shepherd-service (list (shepherd-service
(documentation "Run iwd") (documentation "Run iwd")
(provision '(iwd networking)) (provision '(iwd networking))
(requirement '(user-processes dbus-system loopback)) (requirement '(user-processes dbus-system loopback))
(start #~(make-forkexec-constructor (start #~(make-forkexec-constructor
(list (string-append #$package "/libexec/iwd")) (list (string-append #$iwd "/libexec/iwd"))
#:log-file "/var/log/iwd.log" #:log-file "/var/log/iwd.log"
#:environment-variables #$environment)) #:environment-variables #$environment))
(stop #~(make-kill-destructor))))))) (stop #~(make-kill-destructor))))))))
(define (iwd-etc-service config) (define iwd-etc-service
(match-record config <iwd-configuration> (match-lambda
(config) (($ <iwd-configuration> _ config)
`(("iwd/main.conf" `(("iwd/main.conf"
,(apply mixed-text-file ,(apply mixed-text-file
"main.conf" "main.conf"
(serialize-ini-config config)))))) (serialize-ini-config config)))))))
(define add-iwd-package (compose list iwd-configuration-package)) (define add-iwd-package (compose list iwd-configuration-iwd))
(define iwd-service-type (define iwd-service-type
(service-type (service-type
@ -97,4 +89,4 @@
(service-extension profile-service-type (service-extension profile-service-type
add-iwd-package))) add-iwd-package)))
(default-value (iwd-configuration)) (default-value (iwd-configuration))
(description ""))) (description "Run iwd, the Internet Wireless Daemon.")))

Loading…
Cancel
Save