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