unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#40453] [PATCH] services: add perpipherals
@ 2020-04-05 19:48 Brice Waegeneire
  2020-04-06 14:52 ` Jack Hill
  0 siblings, 1 reply; 2+ messages in thread
From: Brice Waegeneire @ 2020-04-05 19:48 UTC (permalink / raw)
  To: 40453

---
 Makefile                         |  1 +
 modules/config/base.scm          |  4 +---
 modules/config/workstation.scm   |  4 ++--
 modules/services/peripherals.scm | 30 ++++++++++++++++++++++++++++++
 4 files changed, 34 insertions(+), 5 deletions(-)
 create mode 100644 modules/services/peripherals.scm

diff --git a/Makefile b/Makefile
index 9242659..9941cf6 100644
--- a/Makefile
+++ b/Makefile
@@ -7,6 +7,7 @@ MODULES =                               								\
 	$(MODULES_DIR)/config/base.scm                          			\
 	$(MODULES_DIR)/config/workstation.scm                         		\
 	$(MODULES_DIR)/services/kernel-modules.scm                          \
+	$(MODULES_DIR)/services/peripherals.scm                             \
 	$(MODULES_DIR)/utils.scm
 
 SCM_FILES = $(MODULES) $(MISC_SCM_FILES)
diff --git a/modules/config/base.scm b/modules/config/base.scm
index acc76e9..ef80130 100644
--- a/modules/config/base.scm
+++ b/modules/config/base.scm
@@ -75,16 +75,14 @@
                  (supplementary-groups
                   '("wheel" "netdev" "audio" "video"
                     "lp" ; for bluetooth tether
-                    "plugdev" ; TODO extract it to u2f service
+                    "plugdev" ; u2f
                     "input"   ; for brightness control through brightnessctl
                     "adbusers"
                     "kvm" "libvirt"
                     )))
                 %base-user-accounts))
 
-   ;; TODO extract it to u2f service
    (groups (append (list
-                    (user-group (name "plugdev") (system? #t))
                     (user-group (name "adbusers") (system? #t)))
                    %base-groups))
 
diff --git a/modules/config/workstation.scm b/modules/config/workstation.scm
index 2ce09df..a965fbd 100644
--- a/modules/config/workstation.scm
+++ b/modules/config/workstation.scm
@@ -20,6 +20,7 @@
   #:use-module (config base)
   #:use-module (utils)
   #:use-module (services kernel-modules)
+  #:use-module (services peripherals)
   #:use-module (srfi srfi-1)
   #:export (workstation-os
             workstation-packages
@@ -48,8 +49,7 @@
    (service gpm-service-type)           ; Mouse on console
    (service pcscd-service-type)
    (load-kernel-modules-service '("ddcci" "ddcci_backlight"))
-   ;; TODO replace the following line with (service u2f-service-type)
-   (simple-service 'u2f-udev udev-service-type (list libu2f-host))
+   (service u2f-service-type)
    (simple-service 'android-udev udev-service-type (list android-udev-rules))
    (simple-service 'backlight-udev udev-service-type (list brightnessctl))))
 
diff --git a/modules/services/peripherals.scm b/modules/services/peripherals.scm
new file mode 100644
index 0000000..6d2d484
--- /dev/null
+++ b/modules/services/peripherals.scm
@@ -0,0 +1,30 @@
+(define-module (services peripherals)
+  #:use-module (gnu services)
+  #:use-module (gnu services base)
+  #:use-module (gnu services configuration)
+  #:use-module (gnu system accounts)
+  #:use-module (gnu system shadow)
+  #:use-module (gnu packages security-token)
+  #:use-module (guix packages)
+  #:export (u2f-service-type))
+
+(define-configuration u2f-configuration
+  (u2f    (package libu2f-host)
+          "The u2f package"))
+
+(define (u2f-udev-service config)
+  (list (u2f-configuration-u2f config)))
+
+(define u2f-accounts
+  (const (list (user-group (name "plugdev") (system? #t)))))
+
+(define u2f-service-type
+  (service-type (name 'u2f)
+                (extensions
+                 (list (service-extension udev-service-type
+                                          u2f-udev-service)
+                       (service-extension account-service-type
+                                          u2f-accounts)))
+                (default-value (u2f-configuration))
+                (description
+                 "Give access to u2f tokens for plugdev members.")))
-- 
2.26.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [bug#40453] [PATCH] services: add perpipherals
  2020-04-05 19:48 [bug#40453] [PATCH] services: add perpipherals Brice Waegeneire
@ 2020-04-06 14:52 ` Jack Hill
  0 siblings, 0 replies; 2+ messages in thread
From: Jack Hill @ 2020-04-06 14:52 UTC (permalink / raw)
  To: Brice Waegeneire; +Cc: 40453

On Sun, 5 Apr 2020, Brice Waegeneire wrote:

> ---
> Makefile                         |  1 +
> modules/config/base.scm          |  4 +---
> modules/config/workstation.scm   |  4 ++--
> modules/services/peripherals.scm | 30 ++++++++++++++++++++++++++++++
> 4 files changed, 34 insertions(+), 5 deletions(-)
> create mode 100644 modules/services/peripherals.scm

I don't have any comments on the contents of the patch, but wanted to ask 
that this change be mentioned in etc/news.scm so that folks can update 
their operating system definitions.

Thanks!
Jack

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-06 14:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-05 19:48 [bug#40453] [PATCH] services: add perpipherals Brice Waegeneire
2020-04-06 14:52 ` Jack Hill

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).