[PATCH] services: add perpipherals

  • Done
  • quality assurance status badge
Details
2 participants
  • Brice Waegeneire
  • Jack Hill
Owner
unassigned
Submitted by
Brice Waegeneire
Severity
normal
B
B
Brice Waegeneire wrote on 5 Apr 2020 21:48
(address . guix-patches@gnu.org)
20200405194832.20198-1-brice@waegenei.re
---
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

Toggle diff (94 lines)
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
B
B
Brice Waegeneire wrote on 5 Apr 2020 21:51
close 40453
(address . control@debbugs.gnu.org)
9af6c6a2332bd0974be21510479a83fb@waegenei.re
# That's embarrassing; wrong repo...
close 40453
quit
J
J
Jack Hill wrote on 6 Apr 2020 16:52
Re: [bug#40453] [PATCH] services: add perpipherals
(name . Brice Waegeneire)(address . brice@waegenei.re)(address . 40453@debbugs.gnu.org)
alpine.DEB.2.20.2004061049570.5735@marsh.hcoop.net
On Sun, 5 Apr 2020, Brice Waegeneire wrote:

Toggle quote (8 lines)
> ---
> 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
?