From 7b466039798f38e5e1314f1c2a492dc17dbebc01 Mon Sep 17 00:00:00 2001 From: Alex Griffin Date: Fri, 31 May 2019 09:50:54 -0500 Subject: services: Add load-broadcom-sta-service. * nongnu/services/kernel-modules.scm: New file. --- nongnu/services/kernel-modules.scm | 75 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 nongnu/services/kernel-modules.scm (limited to 'nongnu/services') diff --git a/nongnu/services/kernel-modules.scm b/nongnu/services/kernel-modules.scm new file mode 100644 index 0000000..4fac783 --- /dev/null +++ b/nongnu/services/kernel-modules.scm @@ -0,0 +1,75 @@ +;;; Copyright © 2019 Alex Griffin +;;; +;;; This program is free software: you can redistribute it and/or modify +;;; it under the terms of the GNU General Public License as published by +;;; the Free Software Foundation, either version 3 of the License, or +;;; (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program. If not, see . + +(define-module (nongnu services kernel-modules) + #:use-module (gnu packages linux) + #:use-module (gnu services) + #:use-module (gnu services base) + #:use-module (gnu services shepherd) + #:use-module (guix gexp) + #:use-module (guix records) + #:use-module (ice-9 match) + #:use-module (nongnu packages linux) + #:export (load-broadcom-sta-service)) + +;;; +;;; broadcom-sta +;;; + +(define-record-type* + load-broadcom-sta-configuration make-load-broadcom-sta-configuration + load-broadcom-sta-configuration? + (package load-broadcom-sta-configuration-package + (default broadcom-sta))) + +(define load-broadcom-sta-shepherd-service + (match-lambda + (($ package) + (list + (shepherd-service + (documentation "Load nonfree Broadcom wireless driver.") + (provision '(load-broadcom-sta)) + (respawn? #f) + (start + #~(lambda _ + (and + (zero? (system* "modprobe" "cfg80211")) + (zero? (system* "modprobe" "lib80211")) + (zero? (system* "env" (string-append + "LINUX_MODULE_DIRECTORY=" + #$(file-append package "/lib/modules")) + "modprobe" "wl")))))))))) + +(define load-broadcom-sta-service-type + (service-type + (name 'load-broadcom-sta) + (extensions + (list + (service-extension profile-service-type + (compose list load-broadcom-sta-configuration-package)) + (service-extension shepherd-root-service-type + load-broadcom-sta-shepherd-service))) + (description "Load the nonfree Broadcom wireless driver.") + (default-value (load-broadcom-sta-configuration)))) + +(define* (load-broadcom-sta-service #:key (broadcom-sta broadcom-sta)) + "Return a service that loads the nonfree Broadcom wireless driver. + +Users should also blacklist conflicting modules by adding the following +to kernel-arguments: +modprobe.blacklist=b43,b43legacy,ssb,bcm43xx,brcm80211,brcmfmac,brcmsmac,bcma" + (service load-broadcom-sta-service-type + (load-broadcom-sta-configuration + (package broadcom-sta)))) -- cgit v1.2.3