Commit | Line | Data |
---|---|---|
fc91c17a | 1 | ;;; GNU Guix --- Functional package management for GNU |
0d22fc8d | 2 | ;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org> |
b2a5fa59 | 3 | ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org> |
f0fbf2c1 | 4 | ;;; Copyright © 2016 Andreas Enge <andreas@enge.fr> |
c80cd4df | 5 | ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com> |
b24f561c | 6 | ;;; Copyright © 2017, 2019 Tobias Geerinckx-Rice <me@tobias.gr> |
557e6820 | 7 | ;;; Copyright © 2020 Florian Pelz <pelzflorian@pelzflorian.de> |
4170af49 | 8 | ;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il> |
fc91c17a LC |
9 | ;;; |
10 | ;;; This file is part of GNU Guix. | |
11 | ;;; | |
12 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
13 | ;;; under the terms of the GNU General Public License as published by | |
14 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
15 | ;;; your option) any later version. | |
16 | ;;; | |
17 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
18 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 | ;;; GNU General Public License for more details. | |
21 | ;;; | |
22 | ;;; You should have received a copy of the GNU General Public License | |
23 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
24 | ||
25 | (define-module (gnu system install) | |
26 | #:use-module (gnu) | |
d0f3a672 | 27 | #:use-module (gnu system) |
ceb39527 | 28 | #:use-module (gnu bootloader u-boot) |
fc91c17a | 29 | #:use-module (guix gexp) |
e87f0591 | 30 | #:use-module (guix store) |
fc91c17a | 31 | #:use-module (guix monads) |
557e6820 | 32 | #:use-module (guix modules) |
0134ebc5 | 33 | #:use-module ((guix packages) #:select (package-version)) |
83a17b62 | 34 | #:use-module ((guix store) #:select (%store-prefix)) |
a49d633c | 35 | #:use-module (gnu installer) |
ea5d9bf9 | 36 | #:use-module (gnu system locale) |
8361817b | 37 | #:use-module (gnu services avahi) |
d0f3a672 MO |
38 | #:use-module (gnu services dbus) |
39 | #:use-module (gnu services networking) | |
0190c1c0 | 40 | #:use-module (gnu services shepherd) |
c80cd4df | 41 | #:use-module (gnu services ssh) |
db84467a | 42 | #:use-module (gnu packages admin) |
f4bdfe73 | 43 | #:use-module (gnu packages bash) |
862e38d5 | 44 | #:use-module (gnu packages bootloaders) |
9ce09a76 | 45 | #:use-module (gnu packages certs) |
4170af49 | 46 | #:use-module (gnu packages compression) |
d0f3a672 MO |
47 | #:use-module (gnu packages fonts) |
48 | #:use-module (gnu packages fontutils) | |
af4a761e | 49 | #:use-module (gnu packages guile) |
fc91c17a | 50 | #:use-module (gnu packages linux) |
fc91c17a | 51 | #:use-module (gnu packages package-management) |
fc91c17a | 52 | #:use-module (gnu packages texinfo) |
557e6820 | 53 | #:use-module (gnu packages xorg) |
e1fbc32a LC |
54 | #:use-module (ice-9 match) |
55 | #:use-module (srfi srfi-26) | |
ceb39527 | 56 | #:export (installation-os |
c55c6985 | 57 | a20-olinuxino-lime-installation-os |
4b9e9abb | 58 | a20-olinuxino-lime2-emmc-installation-os |
a7bb327e | 59 | a20-olinuxino-micro-installation-os |
e830c9d0 | 60 | bananapi-m2-ultra-installation-os |
84ee3378 | 61 | beaglebone-black-installation-os |
07ca9045 | 62 | mx6cuboxi-installation-os |
fd5536e3 | 63 | nintendo-nes-classic-edition-installation-os |
1b960787 | 64 | novena-installation-os |
545ff7b7 | 65 | firefly-rk3399-installation-os |
9f7d6665 | 66 | pine64-plus-installation-os |
74e35e8c | 67 | pinebook-installation-os |
2fce14af | 68 | rock64-installation-os |
fa747018 | 69 | rockpro64-installation-os |
6fe16577 | 70 | rk3399-puma-installation-os |
4ce4fc50 DM |
71 | wandboard-installation-os |
72 | os-with-u-boot)) | |
fc91c17a LC |
73 | |
74 | ;;; Commentary: | |
75 | ;;; | |
76 | ;;; This module provides an 'operating-system' definition for use on images | |
77 | ;;; for USB sticks etc., for the installation of the GNU system. | |
78 | ;;; | |
79 | ;;; Code: | |
80 | ||
9d3fb6c7 | 81 | \f |
126d4c12 LC |
82 | ;;; |
83 | ;;; Documentation service. | |
84 | ;;; | |
85 | ||
c7dc6042 LC |
86 | (define %installation-node-names |
87 | ;; Translated name of the "System Installation" node of the manual. Ideally | |
88 | ;; we'd extract it from the 'guix-manual' gettext domain, but that one is | |
89 | ;; usually not available at run time, hence this hack. | |
90 | '(("de" . "Systeminstallation") | |
91 | ("en" . "System Installation") | |
55111549 | 92 | ("es" . "Instalación del sistema") |
7059cfc8 LC |
93 | ("fr" . "Installation du système") |
94 | ("ru" . "Установка системы"))) | |
c7dc6042 | 95 | |
126d4c12 | 96 | (define (log-to-info tty user) |
fc91c17a LC |
97 | "Return a script that spawns the Info reader on the right section of the |
98 | manual." | |
ce8a6dfc | 99 | (program-file "log-to-info" |
c7dc6042 LC |
100 | #~(let* ((tty (open-file #$(string-append "/dev/" tty) |
101 | "r0+")) | |
102 | (locale (cadr (command-line))) | |
103 | (language (string-take locale | |
104 | (string-index locale #\_))) | |
105 | (infodir "/run/current-system/profile/share/info") | |
106 | (per-lang (string-append infodir "/guix." language | |
107 | ".info.gz")) | |
108 | (file (if (file-exists? per-lang) | |
109 | per-lang | |
110 | (string-append infodir "/guix.info"))) | |
111 | (node (or (assoc-ref '#$%installation-node-names | |
112 | language) | |
113 | "System Installation"))) | |
126d4c12 LC |
114 | (redirect-port tty (current-output-port)) |
115 | (redirect-port tty (current-error-port)) | |
116 | (redirect-port tty (current-input-port)) | |
117 | ||
118 | (let ((pw (getpwnam #$user))) | |
119 | (setgid (passwd:gid pw)) | |
120 | (setuid (passwd:uid pw))) | |
121 | ||
dd6b28d1 LC |
122 | ;; 'gunzip' is needed to decompress the doc. |
123 | (setenv "PATH" (string-append #$gzip "/bin")) | |
124 | ||
c7dc6042 LC |
125 | ;; Change this process' locale so that command-line |
126 | ;; arguments to 'info' are properly encoded. | |
127 | (catch #t | |
128 | (lambda () | |
129 | (setlocale LC_ALL locale) | |
130 | (setenv "LC_ALL" locale)) | |
131 | (lambda _ | |
132 | ;; Sometimes LOCALE itself is not available. In that | |
133 | ;; case pick the one UTF-8 locale that's known to work | |
134 | ;; instead of failing. | |
135 | (setlocale LC_ALL "en_US.utf8") | |
136 | (setenv "LC_ALL" "en_US.utf8"))) | |
137 | ||
138 | (execl #$(file-append info-reader "/bin/info") | |
139 | "info" "-d" infodir "-f" file "-n" node)))) | |
fc91c17a | 140 | |
126d4c12 LC |
141 | (define (documentation-shepherd-service tty) |
142 | (list (shepherd-service | |
143 | (provision (list (symbol-append 'term- (string->symbol tty)))) | |
144 | (requirement '(user-processes host-name udev virtual-terminal)) | |
c7dc6042 LC |
145 | (start #~(lambda* (#:optional (locale "en_US.utf8")) |
146 | (fork+exec-command | |
147 | (list #$(log-to-info tty "documentation") locale) | |
148 | #:environment-variables | |
149 | `("GUIX_LOCPATH=/run/current-system/locale" | |
150 | "TERM=linux")))) | |
126d4c12 LC |
151 | (stop #~(make-kill-destructor))))) |
152 | ||
153 | (define %documentation-users | |
154 | ;; User account for the Info viewer. | |
155 | (list (user-account (name "documentation") | |
156 | (system? #t) | |
157 | (group "nogroup") | |
158 | (home-directory "/var/empty")))) | |
159 | ||
160 | (define documentation-service-type | |
161 | ;; Documentation viewer service. | |
162 | (service-type (name 'documentation) | |
163 | (extensions | |
164 | (list (service-extension shepherd-root-service-type | |
165 | documentation-shepherd-service) | |
166 | (service-extension account-service-type | |
167 | (const %documentation-users)))) | |
168 | (description "Run the Info reader on a tty."))) | |
169 | ||
170 | \f | |
83a17b62 LC |
171 | (define %backing-directory |
172 | ;; Sub-directory used as the backing store for copy-on-write. | |
173 | "/tmp/guix-inst") | |
174 | ||
0adfe95a | 175 | (define cow-store-service-type |
d4053c71 | 176 | (shepherd-service-type |
00184239 | 177 | 'cow-store |
0adfe95a | 178 | (lambda _ |
6a060ff2 LC |
179 | (define (import-module? module) |
180 | ;; Since we don't use deduplication support in 'populate-store', don't | |
181 | ;; import (guix store deduplication) and its dependencies, which | |
182 | ;; includes Guile-Gcrypt. | |
183 | (and (guix-module-name? module) | |
184 | (not (equal? module '(guix store deduplication))))) | |
185 | ||
d4053c71 | 186 | (shepherd-service |
0adfe95a LC |
187 | (requirement '(root-file-system user-processes)) |
188 | (provision '(cow-store)) | |
189 | (documentation | |
190 | "Make the store copy-on-write, with writes going to \ | |
191 | the given target.") | |
192 | ||
193 | ;; This is meant to be explicitly started by the user. | |
194 | (auto-start? #f) | |
195 | ||
22827396 MO |
196 | (modules `((gnu build install) |
197 | ,@%default-modules)) | |
198 | (start | |
199 | (with-imported-modules (source-module-closure | |
6a060ff2 LC |
200 | '((gnu build install)) |
201 | #:select? import-module?) | |
22827396 MO |
202 | #~(case-lambda |
203 | ((target) | |
204 | (mount-cow-store target #$%backing-directory) | |
205 | target) | |
206 | (else | |
207 | ;; Do nothing, and mark the service as stopped. | |
208 | #f)))) | |
0adfe95a LC |
209 | (stop #~(lambda (target) |
210 | ;; Delete the temporary directory, but leave everything | |
211 | ;; mounted as there may still be processes using it since | |
6c445817 | 212 | ;; 'user-processes' doesn't depend on us. The 'user-file-systems' |
0adfe95a LC |
213 | ;; service will unmount TARGET eventually. |
214 | (delete-file-recursively | |
0d22fc8d LC |
215 | (string-append target #$%backing-directory)))))) |
216 | (description "Make the store copy-on-write, with writes going to \ | |
217 | the given target."))) | |
0adfe95a | 218 | |
83a17b62 LC |
219 | (define (cow-store-service) |
220 | "Return a service that makes the store copy-on-write, such that writes go to | |
221 | the user's target storage device rather than on the RAM disk." | |
222 | ;; See <http://bugs.gnu.org/18061> for the initial report. | |
0adfe95a LC |
223 | (service cow-store-service-type 'mooooh!)) |
224 | ||
225 | ||
226 | (define (/etc/configuration-files _) | |
227 | "Return a list of tuples representing configuration templates to add to | |
228 | /etc." | |
0adfe95a LC |
229 | (define directory |
230 | (computed-file "configuration-templates" | |
4ee96a79 LC |
231 | (with-imported-modules '((guix build utils)) |
232 | #~(begin | |
233 | (mkdir #$output) | |
234 | (for-each (lambda (file target) | |
235 | (copy-file file | |
236 | (string-append #$output "/" | |
237 | target))) | |
33d1c970 LC |
238 | '(#$(local-file "examples/bare-bones.tmpl") |
239 | #$(local-file "examples/beaglebone-black.tmpl") | |
240 | #$(local-file "examples/desktop.tmpl") | |
241 | #$(local-file "examples/lightweight-desktop.tmpl")) | |
4ee96a79 | 242 | '("bare-bones.scm" |
9f1e39d1 | 243 | "beaglebone-black.scm" |
4ee96a79 LC |
244 | "desktop.scm" |
245 | "lightweight-desktop.scm")) | |
246 | #t)))) | |
0adfe95a LC |
247 | |
248 | `(("configuration" ,directory))) | |
249 | ||
250 | (define configuration-template-service-type | |
251 | (service-type (name 'configuration-template) | |
252 | (extensions | |
253 | (list (service-extension etc-service-type | |
254 | /etc/configuration-files))))) | |
255 | ||
256 | (define %configuration-template-service | |
257 | (service configuration-template-service-type #t)) | |
be1c2c54 | 258 | |
1dac8566 | 259 | |
61ff0a3a LC |
260 | (define %nscd-minimal-caches |
261 | ;; Minimal in-memory caching policy for nscd. | |
262 | (list (nscd-cache (database 'hosts) | |
263 | (positive-time-to-live (* 3600 12)) | |
c96ba2cf LC |
264 | |
265 | ;; Do not cache lookup failures at all since they are | |
266 | ;; quite likely (for instance when someone tries to ping a | |
267 | ;; host before networking is functional.) | |
268 | (negative-time-to-live 0) | |
269 | ||
61ff0a3a LC |
270 | (persistent? #f) |
271 | (max-database-size (* 5 (expt 2 20)))))) ;5 MiB | |
272 | ||
557e6820 FP |
273 | \f |
274 | ;; These define a service to load the uvesafb kernel module with the | |
275 | ;; appropriate options. The GUI installer needs it when the machine does not | |
276 | ;; support Kernel Mode Setting. Otherwise kmscon is missing /dev/fb0. | |
277 | (define (uvesafb-shepherd-service _) | |
278 | (list (shepherd-service | |
80dbad18 FP |
279 | (documentation "Load the uvesafb kernel module if needed.") |
280 | (provision '(maybe-uvesafb)) | |
557e6820 FP |
281 | (requirement '(file-systems)) |
282 | (start #~(lambda () | |
283 | ;; uvesafb is only supported on x86 and x86_64. | |
284 | (or (not (and (string-suffix? "linux-gnu" %host-type) | |
285 | (or (string-prefix? "x86_64" %host-type) | |
286 | (string-prefix? "i686" %host-type)))) | |
0ad60b2a | 287 | (file-exists? "/dev/fb0") |
557e6820 FP |
288 | (invoke #+(file-append kmod "/bin/modprobe") |
289 | "uvesafb" | |
290 | (string-append "v86d=" #$v86d "/sbin/v86d") | |
291 | "mode_option=1024x768")))) | |
292 | (respawn? #f) | |
293 | (one-shot? #t)))) | |
294 | ||
295 | (define uvesafb-service-type | |
296 | (service-type | |
297 | (name 'uvesafb) | |
298 | (extensions | |
299 | (list (service-extension shepherd-root-service-type | |
300 | uvesafb-shepherd-service))) | |
301 | (description | |
302 | "Load the @code{uvesafb} kernel module with the right options.") | |
303 | (default-value #t))) | |
304 | ||
58b21e1e LC |
305 | (define %installation-services |
306 | ;; List of services of the installation system. | |
a7961746 | 307 | (let ((motd (plain-file "motd" " |
6fb6dd13 | 308 | \x1b[1;37mWelcome to the installation of GNU Guix!\x1b[0m |
a7961746 | 309 | |
5a663d87 LC |
310 | \x1b[2m\ |
311 | Using this shell, you can carry out the installation process \"manually.\" | |
312 | Access documentation at any time by pressing Alt-F2.\x1b[0m | |
a7961746 MO |
313 | "))) |
314 | (define (normal-tty tty) | |
315 | (mingetty-service (mingetty-configuration (tty tty) | |
316 | (auto-login "root") | |
317 | (login-pause? #t)))) | |
318 | ||
319 | (define bare-bones-os | |
320 | (load "examples/bare-bones.tmpl")) | |
321 | ||
322 | (list (service virtual-terminal-service-type) | |
323 | ||
324 | (service kmscon-service-type | |
325 | (kmscon-configuration | |
326 | (virtual-terminal "tty1") | |
a49d633c | 327 | (login-program (installer-program)))) |
a7961746 MO |
328 | |
329 | (login-service (login-configuration | |
330 | (motd motd))) | |
331 | ||
332 | ;; Documentation. The manual is in UTF-8, but | |
333 | ;; 'console-font-service' sets up Unicode support and loads a font | |
334 | ;; with all the useful glyphs like em dash and quotation marks. | |
126d4c12 | 335 | (service documentation-service-type "tty2") |
a7961746 MO |
336 | |
337 | ;; Documentation add-on. | |
338 | %configuration-template-service | |
339 | ||
340 | ;; A bunch of 'root' ttys. | |
341 | (normal-tty "tty3") | |
342 | (normal-tty "tty4") | |
343 | (normal-tty "tty5") | |
344 | (normal-tty "tty6") | |
345 | ||
346 | ;; The usual services. | |
347 | (syslog-service) | |
348 | ||
8361817b MO |
349 | ;; Use the Avahi daemon to discover substitute servers on the local |
350 | ;; network. It can be faster than fetching from remote servers. | |
351 | (service avahi-service-type) | |
352 | ||
3a8bfebe TGR |
353 | ;; The build daemon. Register the default substitute server key(s) |
354 | ;; as trusted to allow the installation process to use substitutes by | |
a7961746 MO |
355 | ;; default. |
356 | (service guix-service-type | |
357 | (guix-configuration (authorize-key? #t))) | |
358 | ||
359 | ;; Start udev so that useful device nodes are available. | |
360 | ;; Use device-mapper rules for cryptsetup & co; enable the CRDA for | |
361 | ;; regulations-compliant WiFi access. | |
362 | (udev-service #:rules (list lvm2 crda)) | |
363 | ||
364 | ;; Add the 'cow-store' service, which users have to start manually | |
365 | ;; since it takes the installation directory as an argument. | |
366 | (cow-store-service) | |
367 | ||
13fd0a30 | 368 | ;; Install Unicode support and a suitable font. |
a7961746 | 369 | (service console-font-service-type |
13fd0a30 LC |
370 | (map (match-lambda |
371 | ("tty2" | |
372 | ;; Use a font that contains characters such as | |
373 | ;; curly quotes as found in the manual. | |
374 | '("tty2" . "LatGrkCyr-8x16")) | |
375 | (tty | |
376 | ;; Use a font that doesn't have more than 256 | |
377 | ;; glyphs so that we can use colors with varying | |
378 | ;; brightness levels (see note in setfont(8)). | |
379 | `(,tty . "lat9u-16"))) | |
a7961746 MO |
380 | '("tty1" "tty2" "tty3" "tty4" "tty5" "tty6"))) |
381 | ||
382 | ;; To facilitate copy/paste. | |
383 | (service gpm-service-type) | |
384 | ||
385 | ;; Add an SSH server to facilitate remote installs. | |
386 | (service openssh-service-type | |
387 | (openssh-configuration | |
388 | (port-number 22) | |
389 | (permit-root-login #t) | |
390 | ;; The root account is passwordless, so make sure | |
391 | ;; a password is set before allowing logins. | |
392 | (allow-empty-passwords? #f) | |
393 | (password-authentication? #t) | |
394 | ||
395 | ;; Don't start it upfront. | |
396 | (%auto-start? #f))) | |
397 | ||
398 | ;; Since this is running on a USB stick with a overlayfs as the root | |
399 | ;; file system, use an appropriate cache configuration. | |
400 | (nscd-service (nscd-configuration | |
401 | (caches %nscd-minimal-caches))) | |
402 | ||
403 | ;; Having /bin/sh is a good idea. In particular it allows Tramp | |
404 | ;; connections to this system to work. | |
405 | (service special-files-service-type | |
dfc8ccbf | 406 | `(("/bin/sh" ,(file-append bash "/bin/sh")))) |
a7961746 MO |
407 | |
408 | ;; Loopback device, needed by OpenSSH notably. | |
409 | (service static-networking-service-type | |
410 | (list (static-networking (interface "lo") | |
411 | (ip "127.0.0.1") | |
412 | (requirement '()) | |
413 | (provision '(loopback))))) | |
414 | ||
415 | (service wpa-supplicant-service-type) | |
416 | (dbus-service) | |
417 | (service connman-service-type | |
418 | (connman-configuration | |
419 | (disable-vpn? #t))) | |
420 | ||
421 | ;; Keep a reference to BARE-BONES-OS to make sure it can be | |
422 | ;; installed without downloading/building anything. Also keep the | |
423 | ;; things needed by 'profile-derivation' to minimize the amount of | |
424 | ;; download. | |
425 | (service gc-root-service-type | |
ea5d9bf9 MO |
426 | (append |
427 | (list bare-bones-os | |
428 | glibc-utf8-locales | |
429 | texinfo | |
430 | guile-3.0) | |
431 | %default-locale-libcs)) | |
557e6820 FP |
432 | |
433 | ;; Machines without Kernel Mode Setting (those with many old and | |
434 | ;; current AMD GPUs, SiS GPUs, ...) need uvesafb to show the GUI | |
435 | ;; installer. Some may also need a kernel parameter like nomodeset | |
436 | ;; or vga=793, but we leave that for the user to specify in GRUB. | |
437 | (service uvesafb-service-type)))) | |
fc91c17a LC |
438 | |
439 | (define %issue | |
440 | ;; Greeting. | |
441 | " | |
8638362f | 442 | \x1b[1;37mThis is an installation image of the GNU system. Welcome.\x1b[0m |
fc91c17a | 443 | |
8638362f | 444 | \x1b[1;33mUse Alt-F2 for documentation.\x1b[0m |
fc91c17a LC |
445 | ") |
446 | ||
447 | (define installation-os | |
448 | ;; The operating system used on installation images for USB sticks etc. | |
449 | (operating-system | |
450 | (host-name "gnu") | |
451 | (timezone "Europe/Paris") | |
9cd0dfaa | 452 | (locale "en_US.utf8") |
8361817b | 453 | (name-service-switch %mdns-host-lookup-nss) |
fdfdecdb TGR |
454 | (bootloader (bootloader-configuration |
455 | (bootloader grub-bootloader) | |
456 | (target "/dev/sda"))) | |
0134ebc5 LC |
457 | (label (string-append "GNU Guix installation " |
458 | (package-version guix))) | |
459 | ||
34d436a4 FP |
460 | ;; XXX: The AMD Radeon driver is reportedly broken, which makes kmscon |
461 | ;; non-functional: | |
462 | ;; <https://lists.gnu.org/archive/html/guix-devel/2019-03/msg00441.html>. | |
463 | ;; Thus, blacklist it. | |
464 | (kernel-arguments '("quiet" "modprobe.blacklist=radeon")) | |
465 | ||
fc91c17a LC |
466 | (file-systems |
467 | ;; Note: the disk image build code overrides this root file system with | |
468 | ;; the appropriate one. | |
ee03b75d LC |
469 | (cons* (file-system |
470 | (mount-point "/") | |
59e80445 | 471 | (device (file-system-label "Guix_image")) |
ee03b75d LC |
472 | (type "ext4")) |
473 | ||
d9565f7d HG |
474 | ;; Make /tmp a tmpfs instead of keeping the overlayfs. This |
475 | ;; originally was used for unionfs because FUSE creates | |
476 | ;; '.fuse_hiddenXYZ' files for each open file, and this confuses | |
477 | ;; Guix's test suite, for instance (see | |
478 | ;; <http://bugs.gnu.org/23056>). We keep this for overlayfs to be | |
795ec760 | 479 | ;; on the safe side. |
ee03b75d LC |
480 | (file-system |
481 | (mount-point "/tmp") | |
482 | (device "none") | |
ee03b75d LC |
483 | (type "tmpfs") |
484 | (check? #f)) | |
485 | ||
0feefb53 LC |
486 | ;; XXX: This should be %BASE-FILE-SYSTEMS but we don't need |
487 | ;; elogind's cgroup file systems. | |
488 | (list %pseudo-terminal-file-system | |
489 | %shared-memory-file-system | |
f94835a9 | 490 | %efivars-file-system |
0feefb53 | 491 | %immutable-store))) |
fc91c17a | 492 | |
a7961746 MO |
493 | (users (list (user-account |
494 | (name "guest") | |
495 | (group "users") | |
496 | (supplementary-groups '("wheel")) ; allow use of sudo | |
497 | (password "") | |
cf848cc0 | 498 | (comment "Guest of GNU")))) |
fc91c17a LC |
499 | |
500 | (issue %issue) | |
58b21e1e | 501 | (services %installation-services) |
fc91c17a | 502 | |
903ae630 LC |
503 | ;; We don't need setuid programs, except for 'passwd', which can be handy |
504 | ;; if one is to allow remote SSH login to the machine being installed. | |
505 | (setuid-programs (list (file-append shadow "/bin/passwd"))) | |
fc91c17a LC |
506 | |
507 | (pam-services | |
508 | ;; Explicitly allow for empty passwords. | |
509 | (base-pam-services #:allow-empty-passwords? #t)) | |
510 | ||
4170af49 EF |
511 | (packages (append |
512 | (list glibc ; for 'tzselect' & co. | |
513 | fontconfig | |
514 | font-dejavu font-gnu-unifont | |
515 | grub ; mostly so xrefs to its manual work | |
516 | nss-certs) ; To access HTTPS, use git, etc. | |
517 | %base-packages-disk-utilities | |
518 | %base-packages)))) | |
fc91c17a | 519 | |
4ce4fc50 DM |
520 | (define* (os-with-u-boot os board #:key (bootloader-target "/dev/mmcblk0") |
521 | (triplet "arm-linux-gnueabihf")) | |
522 | "Given OS, amend it with the u-boot bootloader for BOARD, | |
523 | installed to BOOTLOADER-TARGET (a drive), compiled for TRIPLET. | |
524 | ||
525 | If you want a serial console, make sure to specify one in your | |
526 | operating-system's kernel-arguments (\"console=ttyS0\" or similar)." | |
527 | (operating-system (inherit os) | |
528 | (bootloader (bootloader-configuration | |
529 | (bootloader (bootloader (inherit u-boot-bootloader) | |
530 | (package (make-u-boot-package board triplet)))) | |
531 | (target bootloader-target))))) | |
532 | ||
fccdc8c8 DM |
533 | (define* (embedded-installation-os bootloader bootloader-target tty |
534 | #:key (extra-modules '())) | |
535 | "Return an installation os for embedded systems. | |
536 | The initrd gets the extra modules EXTRA-MODULES. | |
537 | A getty is provided on TTY. | |
538 | The bootloader BOOTLOADER is installed to BOOTLOADER-TARGET." | |
ceb39527 MO |
539 | (operating-system |
540 | (inherit installation-os) | |
541 | (bootloader (bootloader-configuration | |
fccdc8c8 DM |
542 | (bootloader bootloader) |
543 | (target bootloader-target))) | |
ceb39527 | 544 | (kernel linux-libre) |
5a9902c8 DM |
545 | (kernel-arguments |
546 | (cons (string-append "console=" tty) | |
547 | (operating-system-user-kernel-arguments installation-os))) | |
bc499b11 | 548 | (initrd-modules (append extra-modules %base-initrd-modules)))) |
ceb39527 | 549 | |
fccdc8c8 DM |
550 | (define beaglebone-black-installation-os |
551 | (embedded-installation-os u-boot-beaglebone-black-bootloader | |
552 | "/dev/sda" | |
553 | "ttyO0" | |
554 | #:extra-modules | |
555 | ;; This module is required to mount the sd card. | |
556 | '("omap_hsmmc"))) | |
557 | ||
558 | ||
0db22b32 | 559 | (define a20-olinuxino-lime-installation-os |
c55c6985 DM |
560 | (embedded-installation-os u-boot-a20-olinuxino-lime-bootloader |
561 | "/dev/mmcblk0" ; SD card storage | |
562 | "ttyS0")) | |
563 | ||
4b9e9abb | 564 | (define a20-olinuxino-lime2-emmc-installation-os |
fccdc8c8 DM |
565 | (embedded-installation-os u-boot-a20-olinuxino-lime2-bootloader |
566 | "/dev/mmcblk1" ; eMMC storage | |
567 | "ttyS0")) | |
a7bb327e DM |
568 | |
569 | (define a20-olinuxino-micro-installation-os | |
fccdc8c8 DM |
570 | (embedded-installation-os u-boot-a20-olinuxino-micro-bootloader |
571 | "/dev/mmcblk0" ; SD card storage | |
572 | "ttyS0")) | |
4b9e9abb | 573 | |
e830c9d0 DM |
574 | (define bananapi-m2-ultra-installation-os |
575 | (embedded-installation-os u-boot-bananapi-m2-ultra-bootloader | |
fccdc8c8 DM |
576 | "/dev/mmcblk1" ; eMMC storage |
577 | "ttyS0")) | |
30aeb846 | 578 | |
545ff7b7 VC |
579 | (define firefly-rk3399-installation-os |
580 | (embedded-installation-os u-boot-firefly-rk3399-bootloader | |
581 | "/dev/mmcblk0" ; SD card/eMMC (SD priority) storage | |
582 | "ttyS2")) ; UART2 connected on the Pi2 bus | |
583 | ||
07ca9045 VC |
584 | (define mx6cuboxi-installation-os |
585 | (embedded-installation-os u-boot-mx6cuboxi-bootloader | |
586 | "/dev/mmcblk0" ; SD card storage | |
587 | "ttymxc0")) | |
588 | ||
1b960787 VC |
589 | (define novena-installation-os |
590 | (embedded-installation-os u-boot-novena-bootloader | |
591 | "/dev/mmcblk1" ; SD card storage | |
592 | "ttymxc1")) | |
593 | ||
84ee3378 DM |
594 | (define nintendo-nes-classic-edition-installation-os |
595 | (embedded-installation-os u-boot-nintendo-nes-classic-edition-bootloader | |
596 | "/dev/mmcblk0" ; SD card (solder it yourself) | |
597 | "ttyS0")) | |
598 | ||
9f7d6665 VC |
599 | (define pine64-plus-installation-os |
600 | (embedded-installation-os u-boot-pine64-plus-bootloader | |
601 | "/dev/mmcblk0" ; SD card storage | |
602 | "ttyS0")) | |
603 | ||
74e35e8c VC |
604 | (define pinebook-installation-os |
605 | (embedded-installation-os u-boot-pinebook-bootloader | |
606 | "/dev/mmcblk0" ; SD card storage | |
607 | "ttyS0")) | |
608 | ||
2fce14af VC |
609 | (define rock64-installation-os |
610 | (embedded-installation-os u-boot-rock64-rk3328-bootloader | |
611 | "/dev/mmcblk0" ; SD card/eMMC (SD priority) storage | |
612 | "ttyS2")) ; UART2 connected on the Pi2 bus | |
613 | ||
fa747018 CN |
614 | (define rockpro64-installation-os |
615 | (embedded-installation-os u-boot-rockpro64-rk3399-bootloader | |
616 | "/dev/mmcblk0" ; SD card/eMMC (SD priority) storage | |
617 | "ttyS2")) ; UART2 connected on the Pi2 bus | |
618 | ||
6fe16577 VC |
619 | (define rk3399-puma-installation-os |
620 | (embedded-installation-os u-boot-puma-rk3399-bootloader | |
621 | "/dev/mmcblk0" ; SD card storage | |
622 | "ttyS0")) | |
623 | ||
fd5536e3 VC |
624 | (define wandboard-installation-os |
625 | (embedded-installation-os u-boot-wandboard-bootloader | |
626 | "/dev/mmcblk0" ; SD card storage | |
627 | "ttymxc0")) | |
628 | ||
ceb39527 | 629 | ;; Return the default os here so 'guix system' can consume it directly. |
fc91c17a LC |
630 | installation-os |
631 | ||
632 | ;;; install.scm ends here |