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