diff --git a/gnu/system/install.scm b/gnu/system/install.scm index 0965c4d237..826f6d356d 100644 --- a/gnu/system/install.scm +++ b/gnu/system/install.scm @@ -322,6 +322,52 @@ the user's target storage device rather than on the RAM disk." "Load the @code{uvesafb} kernel module with the right options.") (default-value #t))) +(define (simulated-wifi-shepherd-services hostapd) + (define config + (plain-file "hostapd.conf" "\ +interface=wlan1 +ssid=Test Net +channel=1\n")) + + (list (shepherd-service + (provision '(hostapd)) + (requirement '(mac-sim-module unblocked-wifi)) + (start #~(make-forkexec-constructor + (list #$(file-append hostapd "/sbin/hostapd") + #$config) + #:log-file "/var/log/hostapd.log")) + (stop #~(make-kill-destructor))) + (shepherd-service + (provision '(unblocked-wifi)) + (requirement '(mac-sim-module)) + (start #~(lambda _ + (invoke #$(file-append util-linux "/sbin/rfkill") + "unblock" "0") + (invoke #$(file-append util-linux "/sbin/rfkill") + "unblock" "1"))) + (one-shot? #t)) + (shepherd-service + (provision '(mac-sim-module)) + (requirement '(term-tty3)) + (modules '((guix build utils))) + (start #~(lambda _ + ;; XXX: We can't use 'load-linux-module*' here because it + ;; expects a flat module directory. + (setenv "LINUX_MODULE_DIRECTORY" + "/run/booted-system/kernel/lib/modules") + (invoke #$(file-append kmod "/bin/modprobe") + "mac80211_hwsim"))) + (one-shot? #t)))) + +(define simulated-wifi-service-type + (service-type + (name 'simulated-wifi) + (extensions + (list (service-extension shepherd-root-service-type + simulated-wifi-shepherd-services))) + (default-value hostapd) + (description "Run hostapd to simulate WiFi connectivity."))) + (define %installation-services ;; List of services of the installation system. (let ((motd (plain-file "motd" " @@ -366,6 +412,8 @@ Access documentation at any time by pressing Alt-F2.\x1b[0m ;; The usual services. (syslog-service) + (service simulated-wifi-service-type) + ;; The build daemon. Register the default substitute server key(s) ;; as trusted to allow the installation process to use substitutes by ;; default.