| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 |
|
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 |
|
| 25 | (define-module (gnu services hurd)
|
| 26 | #:use-module (gnu packages admin)
|
| 27 | #:use-module (gnu packages hurd)
|
| 28 | #:use-module (gnu services)
|
| 29 | #:use-module (gnu services shepherd)
|
| 30 | #:use-module (gnu system)
|
| 31 | #:use-module (gnu system shadow)
|
| 32 | #:use-module (guix gexp)
|
| 33 | #:use-module (guix records)
|
| 34 | #:export (hurd-console-configuration
|
| 35 | hurd-console-service-type
|
| 36 | hurd-getty-configuration
|
| 37 | hurd-getty-service-type
|
| 38 |
|
| 39 | hurd-login-configuration
|
| 40 | hurd-login-service-type))
|
| 41 |
|
| 42 | |
| 43 | |
| 44 | |
| 45 |
|
| 46 | (define-record-type* <hurd-console-configuration>
|
| 47 | hurd-console-configuration make-hurd-console-configuration
|
| 48 | hurd-console-configuration?
|
| 49 | (hurd hurd-console-configuration-hurd |
| 50 | (default hurd)))
|
| 51 |
|
| 52 | (define (hurd-console-shepherd-service config)
|
| 53 | "Return a <shepherd-service> for a Hurd VGA console with CONFIG."
|
| 54 |
|
| 55 | (define console-command
|
| 56 | #~(list
|
| 57 | (string-append #$(hurd-console-configuration-hurd config) "/bin/console")
|
| 58 | "-c" "/dev/vcs"
|
| 59 | "-d" "vga"
|
| 60 | "-d" "pc_kbd"
|
| 61 | "-d" "generic_speaker"))
|
| 62 |
|
| 63 | (list (shepherd-service
|
| 64 | (documentation "Run the Hurd’s VGA console client.")
|
| 65 | (provision '(console))
|
| 66 | (requirement '(user-processes))
|
| 67 | (start #~(make-forkexec-constructor #$console-command))
|
| 68 | (stop #~(make-kill-destructor)))))
|
| 69 |
|
| 70 | (define hurd-console-service-type
|
| 71 | (service-type
|
| 72 | (name 'console)
|
| 73 | (description "Run the Hurd console client.")
|
| 74 | (extensions
|
| 75 | (list (service-extension shepherd-root-service-type
|
| 76 | hurd-console-shepherd-service)))
|
| 77 | (default-value (hurd-console-configuration))))
|
| 78 |
|
| 79 |
|
| 80 | |
| 81 | |
| 82 | |
| 83 |
|
| 84 | (define-record-type* <hurd-getty-configuration>
|
| 85 | hurd-getty-configuration make-hurd-getty-configuration
|
| 86 | hurd-getty-configuration?
|
| 87 | (hurd hurd-getty-configuration-hurd |
| 88 | (default hurd))
|
| 89 | (tty hurd-getty-configuration-tty) |
| 90 | (baud-rate hurd-getty-configuration-baud-rate
|
| 91 | (default 38400))) |
| 92 |
|
| 93 | (define (hurd-getty-shepherd-service config)
|
| 94 | "Return a <shepherd-service> for a Hurd getty with CONFIG."
|
| 95 |
|
| 96 | (let ((hurd (hurd-getty-configuration-hurd config))
|
| 97 | (tty (hurd-getty-configuration-tty config))
|
| 98 | (baud-rate (hurd-getty-configuration-baud-rate config)))
|
| 99 |
|
| 100 | (define getty-command
|
| 101 | #~(list
|
| 102 | (string-append #$hurd "/libexec/getty")
|
| 103 | #$(number->string baud-rate)
|
| 104 | #$tty))
|
| 105 |
|
| 106 | (list
|
| 107 | (shepherd-service
|
| 108 | (documentation "Run getty on a tty.")
|
| 109 | (provision (list (string->symbol (string-append "term-" tty))))
|
| 110 | (requirement '(user-processes console))
|
| 111 | (start #~(make-forkexec-constructor #$getty-command))
|
| 112 | (stop #~(make-kill-destructor))))))
|
| 113 |
|
| 114 | (define hurd-getty-service-type
|
| 115 | (service-type
|
| 116 | (name 'getty)
|
| 117 | (extensions (list (service-extension shepherd-root-service-type
|
| 118 | hurd-getty-shepherd-service)))
|
| 119 | (description
|
| 120 | "Provide console login using the Hurd @command{getty} program.")))
|
| 121 |
|
| 122 | |
| 123 | |
| 124 | |
| 125 |
|
| 126 | (define-record-type* <hurd-login-configuration>
|
| 127 | hurd-login-configuration make-hurd-login-configuration
|
| 128 | hurd-login-configuration?
|
| 129 | (hurd hurd-login-configuration-hurd |
| 130 | (default hurd)))
|
| 131 |
|
| 132 | (define (hurd-login-accounts config)
|
| 133 | (let ((hurd (hurd-login-configuration-hurd config)))
|
| 134 | (list (user-group
|
| 135 | (name "login")
|
| 136 | (system? #t))
|
| 137 | (user-account
|
| 138 | (name "login")
|
| 139 | (group "login")
|
| 140 | (system? #t)
|
| 141 | (comment "login user")
|
| 142 | (home-directory "/etc/login")
|
| 143 | (shell (file-append hurd "/bin/loginpr"))))))
|
| 144 |
|
| 145 | (define hurd-login-service-type
|
| 146 | (service-type
|
| 147 | (name 'login)
|
| 148 | (extensions (list (service-extension account-service-type
|
| 149 | hurd-login-accounts)))
|
| 150 | (description
|
| 151 | "Provide the login user for use by the Hurd @command{login} command.")
|
| 152 | (default-value (hurd-login-configuration))))
|
| 153 |
|
| 154 | |