2018-11-16 11:43:55 +00:00
|
|
|
;;; GNU Guix --- Functional package management for GNU
|
2020-02-10 13:47:56 +00:00
|
|
|
;;; Copyright © 2018, 2020 Mathieu Othacehe <m.othacehe@gmail.com>
|
2020-02-19 11:08:40 +00:00
|
|
|
;;; Copyright © 2019, 2020 Ludovic Courtès <ludo@gnu.org>
|
2020-01-03 18:26:54 +00:00
|
|
|
;;; Copyright © 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
|
2020-04-09 00:17:22 +00:00
|
|
|
;;; Copyright © 2020 Florian Pelz <pelzflorian@pelzflorian.de>
|
2018-11-16 11:43:55 +00:00
|
|
|
;;;
|
|
|
|
;;; This file is part of GNU Guix.
|
|
|
|
;;;
|
|
|
|
;;; GNU Guix is free software; you can redistribute it and/or modify it
|
|
|
|
;;; under the terms of the GNU General Public License as published by
|
|
|
|
;;; the Free Software Foundation; either version 3 of the License, or (at
|
|
|
|
;;; your option) any later version.
|
|
|
|
;;;
|
|
|
|
;;; GNU Guix is distributed in the hope that it will be useful, but
|
|
|
|
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;;; GNU General Public License for more details.
|
|
|
|
;;;
|
|
|
|
;;; You should have received a copy of the GNU General Public License
|
|
|
|
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
(define-module (gnu installer)
|
2018-12-05 05:57:28 +00:00
|
|
|
#:use-module (guix discovery)
|
2018-11-24 03:25:03 +00:00
|
|
|
#:use-module (guix packages)
|
|
|
|
#:use-module (guix gexp)
|
|
|
|
#:use-module (guix modules)
|
|
|
|
#:use-module (guix utils)
|
2018-11-16 11:43:55 +00:00
|
|
|
#:use-module (guix ui)
|
2018-11-24 03:25:03 +00:00
|
|
|
#:use-module ((guix self) #:select (make-config.scm))
|
2020-01-22 21:51:20 +00:00
|
|
|
#:use-module (guix packages)
|
|
|
|
#:use-module (guix git-download)
|
2020-02-19 11:08:40 +00:00
|
|
|
#:use-module (gnu installer utils)
|
2018-11-24 03:25:03 +00:00
|
|
|
#:use-module (gnu packages admin)
|
|
|
|
#:use-module (gnu packages base)
|
|
|
|
#:use-module (gnu packages bash)
|
|
|
|
#:use-module (gnu packages connman)
|
installer: partionment: Add encryption support.
* gnu/installer.scm (set-installer-path): Add cryptsetup.
* gnu/installer/newt/partition.scm (prompt-luks-passwords): New procedure,
(run-partioning-page): Add the possibility to set encryption to "On" on a
partition and choose a label, add a new partition scheme: "Guided - using the
entire disk with encryption", prompt for encryption passwords before
proceeding to formating.
* gnu/installer/parted.scm (<user-partition>)[crypt-label],
[crypt-password]: New fields,
(partition-description): add the encryption label,
(user-partition-description): add an encryption field,
(auto-partition): add two partitioning schemes: entire-crypted-root and
entire-crypted-root-home,
(call-with-luks-key-file): new procedure,
(user-partition-upper-path): new procedure,
(luks-format-and-open): new procedure,
(luks-close): new procedure,
(format-user-partitions): format and open luks partitions before creating
file-system.
(mount-user-partitions): use the path returned by user-partition-upper-path,
(umount-user-partitions): close the luks partitions,
(user-partition->file-system): set device field to label for luks partitions
and to uuid for the rest,
(user-partition->mapped-device): new procedure,
(user-partitions->configuration): add mapped-devices field.
2018-12-07 05:04:25 +00:00
|
|
|
#:use-module (gnu packages cryptsetup)
|
2018-12-05 05:57:28 +00:00
|
|
|
#:use-module (gnu packages disk)
|
2020-01-03 18:26:54 +00:00
|
|
|
#:use-module (gnu packages file-systems)
|
2018-11-24 03:25:03 +00:00
|
|
|
#:use-module (gnu packages guile)
|
gnu: Move most packages from guile.scm to new module.
* gnu/packages/guile.scm (artanis, guildhall, guile-aspell, guile-bash,
guile-8sync, guile-daemon, guile-dsv, guile-fibers, guile-syntax-highlight,
guile-sjson, guile-colorized, guile-pfds, guile-aa-tree, guile-simple-zmq,
jupyter-guile-kernel, guile-sparql, guile-debbugs, guile-email,
guile-debbugs-next, guile-newt, guile-mastodon, guile-parted, guile-xosd,
guile-dbi, guile-dbd-sqlite3, guile-config, guile-hall, guile-ics, guile-wisp,
guile-sly, g-wrap, guile-miniadapton, guile-reader, guile2.2-reader,
guile-ncurses, guile-ncurses/gpm, guile-lib, guile2.0-lib, guile2.2-lib,
guile-minikanren, guile2.0-minikanren, guile2.2-minikanren, guile-irregex,
guile2.0-irregex, guile2.2-irregex, haunt, guile2.0-haunt, guile2.2-haunt,
guile-redis, guile2.0-redis, guile2.2-redis, guile-commonmark,
guile2.0-commonmark, guile2.2-commonmark, mcron, mcron2): Move these variables
from here...
* gnu/packages/guile-xyz.scm: ...to this new file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
* gnu/installer.scm,
gnu/packages/bioinformatics.scm,
gnu/packages/ci.scm,
gnu/packages/gtk.scm,
gnu/packages/guile.scm,
gnu/packages/mail.scm,
gnu/packages/package-management.scm,
gnu/packages/skribilo.scm,
gnu/packages/web.scm,
gnu/services/mcron.scm: Update module references.
2019-01-28 13:57:10 +00:00
|
|
|
#:use-module (gnu packages guile-xyz)
|
2018-11-24 03:25:03 +00:00
|
|
|
#:autoload (gnu packages gnupg) (guile-gcrypt)
|
|
|
|
#:use-module (gnu packages iso-codes)
|
|
|
|
#:use-module (gnu packages linux)
|
|
|
|
#:use-module (gnu packages ncurses)
|
|
|
|
#:use-module (gnu packages package-management)
|
|
|
|
#:use-module (gnu packages xorg)
|
2019-05-13 21:30:51 +00:00
|
|
|
#:use-module (gnu system locale)
|
2018-11-24 03:25:03 +00:00
|
|
|
#:use-module (ice-9 match)
|
2018-11-16 11:43:55 +00:00
|
|
|
#:use-module (srfi srfi-1)
|
2018-11-24 03:25:03 +00:00
|
|
|
#:export (installer-program))
|
2018-11-16 11:43:55 +00:00
|
|
|
|
2019-03-26 22:06:51 +00:00
|
|
|
(define module-to-import?
|
|
|
|
;; Return true for modules that should be imported. For (gnu system …) and
|
|
|
|
;; (gnu packages …) modules, we simply add the whole 'guix' package via
|
|
|
|
;; 'with-extensions' (to avoid having to rebuild it all), which is why these
|
|
|
|
;; modules are excluded here.
|
2018-11-24 03:25:03 +00:00
|
|
|
(match-lambda
|
|
|
|
(('guix 'config) #f)
|
2019-03-26 22:06:51 +00:00
|
|
|
(('gnu 'installer _ ...) #t)
|
|
|
|
(('gnu 'build _ ...) #t)
|
|
|
|
(('guix 'build _ ...) #t)
|
|
|
|
(_ #f)))
|
2018-11-24 03:25:03 +00:00
|
|
|
|
2020-03-22 14:51:40 +00:00
|
|
|
(define not-config?
|
|
|
|
;; Select (guix …) and (gnu …) modules, except (guix config).
|
|
|
|
(match-lambda
|
|
|
|
(('guix 'config) #f)
|
|
|
|
(('guix _ ...) #t)
|
|
|
|
(('gnu _ ...) #t)
|
|
|
|
(_ #f)))
|
|
|
|
|
2018-11-24 03:25:03 +00:00
|
|
|
(define* (build-compiled-file name locale-builder)
|
|
|
|
"Return a file-like object that evalutes the gexp LOCALE-BUILDER and store
|
|
|
|
its result in the scheme file NAME. The derivation will also build a compiled
|
|
|
|
version of this file."
|
|
|
|
(define set-utf8-locale
|
|
|
|
#~(begin
|
|
|
|
(setenv "LOCPATH"
|
|
|
|
#$(file-append glibc-utf8-locales "/lib/locale/"
|
|
|
|
(version-major+minor
|
|
|
|
(package-version glibc-utf8-locales))))
|
|
|
|
(setlocale LC_ALL "en_US.utf8")))
|
|
|
|
|
|
|
|
(define builder
|
2019-07-21 21:05:54 +00:00
|
|
|
(with-extensions (list guile-json-3)
|
2020-03-22 14:51:40 +00:00
|
|
|
(with-imported-modules `(,@(source-module-closure
|
|
|
|
'((gnu installer locale))
|
|
|
|
#:select? not-config?)
|
|
|
|
((guix config) => ,(make-config.scm)))
|
2018-11-24 03:25:03 +00:00
|
|
|
#~(begin
|
|
|
|
(use-modules (gnu installer locale))
|
|
|
|
|
|
|
|
;; The locale files contain non-ASCII characters.
|
|
|
|
#$set-utf8-locale
|
|
|
|
|
|
|
|
(mkdir #$output)
|
|
|
|
(let ((locale-file
|
|
|
|
(string-append #$output "/" #$name ".scm"))
|
|
|
|
(locale-compiled-file
|
|
|
|
(string-append #$output "/" #$name ".go")))
|
|
|
|
(call-with-output-file locale-file
|
|
|
|
(lambda (port)
|
|
|
|
(write #$locale-builder port)))
|
|
|
|
(compile-file locale-file
|
|
|
|
#:output-file locale-compiled-file))))))
|
|
|
|
(computed-file name builder))
|
|
|
|
|
|
|
|
(define apply-locale
|
|
|
|
;; Install the specified locale.
|
2019-04-12 15:13:26 +00:00
|
|
|
(with-imported-modules (source-module-closure '((gnu services herd)))
|
|
|
|
#~(lambda (locale)
|
|
|
|
(false-if-exception
|
|
|
|
(setlocale LC_ALL locale))
|
|
|
|
|
|
|
|
;; Restart the documentation viewer so it displays the manual in
|
2020-04-01 12:43:35 +00:00
|
|
|
;; language that corresponds to LOCALE. Make sure that nothing is
|
|
|
|
;; printed on the console.
|
|
|
|
(parameterize ((shepherd-message-port
|
|
|
|
(%make-void-port "w")))
|
2019-04-12 15:13:26 +00:00
|
|
|
(lambda ()
|
|
|
|
(stop-service 'term-tty2)
|
|
|
|
(start-service 'term-tty2 (list locale)))))))
|
2018-11-24 03:25:03 +00:00
|
|
|
|
|
|
|
(define* (compute-locale-step #:key
|
|
|
|
locales-name
|
|
|
|
iso639-languages-name
|
|
|
|
iso3166-territories-name)
|
|
|
|
"Return a gexp that run the locale-page of INSTALLER, and install the
|
|
|
|
selected locale. The list of locales, languages and territories passed to
|
|
|
|
locale-page are computed in derivations named respectively LOCALES-NAME,
|
|
|
|
ISO639-LANGUAGES-NAME and ISO3166-TERRITORIES-NAME. Those lists are compiled,
|
|
|
|
so that when the installer is run, all the lengthy operations have already
|
|
|
|
been performed at build time."
|
|
|
|
(define (compiled-file-loader file name)
|
|
|
|
#~(load-compiled
|
|
|
|
(string-append #$file "/" #$name ".go")))
|
|
|
|
|
|
|
|
(let* ((supported-locales #~(supported-locales->locales
|
2019-05-13 21:30:51 +00:00
|
|
|
#+(glibc-supported-locales)))
|
2018-11-24 03:25:03 +00:00
|
|
|
(iso-codes #~(string-append #$iso-codes "/share/iso-codes/json/"))
|
|
|
|
(iso639-3 #~(string-append #$iso-codes "iso_639-3.json"))
|
|
|
|
(iso639-5 #~(string-append #$iso-codes "iso_639-5.json"))
|
|
|
|
(iso3166 #~(string-append #$iso-codes "iso_3166-1.json"))
|
|
|
|
(locales-file (build-compiled-file
|
|
|
|
locales-name
|
|
|
|
#~`(quote ,#$supported-locales)))
|
|
|
|
(iso639-file (build-compiled-file
|
|
|
|
iso639-languages-name
|
|
|
|
#~`(quote ,(iso639->iso639-languages
|
|
|
|
#$supported-locales
|
|
|
|
#$iso639-3 #$iso639-5))))
|
|
|
|
(iso3166-file (build-compiled-file
|
|
|
|
iso3166-territories-name
|
|
|
|
#~`(quote ,(iso3166->iso3166-territories #$iso3166))))
|
|
|
|
(locales-loader (compiled-file-loader locales-file
|
|
|
|
locales-name))
|
|
|
|
(iso639-loader (compiled-file-loader iso639-file
|
|
|
|
iso639-languages-name))
|
|
|
|
(iso3166-loader (compiled-file-loader iso3166-file
|
|
|
|
iso3166-territories-name)))
|
|
|
|
#~(lambda (current-installer)
|
|
|
|
(let ((result
|
|
|
|
((installer-locale-page current-installer)
|
|
|
|
#:supported-locales #$locales-loader
|
|
|
|
#:iso639-languages #$iso639-loader
|
|
|
|
#:iso3166-territories #$iso3166-loader)))
|
2018-12-05 05:30:16 +00:00
|
|
|
(#$apply-locale result)
|
|
|
|
result))))
|
2018-11-24 03:25:03 +00:00
|
|
|
|
|
|
|
(define apply-keymap
|
2018-12-05 05:36:22 +00:00
|
|
|
;; Apply the specified keymap. Use the default keyboard model.
|
2018-11-24 03:25:03 +00:00
|
|
|
#~(match-lambda
|
2020-04-09 00:17:22 +00:00
|
|
|
((layout variant options)
|
2018-12-05 05:36:22 +00:00
|
|
|
(kmscon-update-keymap (default-keyboard-model)
|
2020-04-09 00:17:22 +00:00
|
|
|
layout variant options))))
|
2018-11-24 03:25:03 +00:00
|
|
|
|
2020-03-30 10:24:56 +00:00
|
|
|
(define* (compute-keymap-step context)
|
2018-11-24 03:25:03 +00:00
|
|
|
"Return a gexp that runs the keymap-page of INSTALLER and install the
|
|
|
|
selected keymap."
|
|
|
|
#~(lambda (current-installer)
|
|
|
|
(let ((result
|
|
|
|
(call-with-values
|
|
|
|
(lambda ()
|
|
|
|
(xkb-rules->models+layouts
|
|
|
|
(string-append #$xkeyboard-config
|
|
|
|
"/share/X11/xkb/rules/base.xml")))
|
|
|
|
(lambda (models layouts)
|
|
|
|
((installer-keymap-page current-installer)
|
2020-03-30 10:24:56 +00:00
|
|
|
layouts '#$context)))))
|
2019-03-25 22:21:08 +00:00
|
|
|
(#$apply-keymap result)
|
|
|
|
result)))
|
2018-11-24 03:25:03 +00:00
|
|
|
|
|
|
|
(define (installer-steps)
|
|
|
|
(let ((locale-step (compute-locale-step
|
|
|
|
#:locales-name "locales"
|
|
|
|
#:iso639-languages-name "iso639-languages"
|
|
|
|
#:iso3166-territories-name "iso3166-territories"))
|
|
|
|
(timezone-data #~(string-append #$tzdata
|
|
|
|
"/share/zoneinfo/zone.tab")))
|
|
|
|
#~(lambda (current-installer)
|
2020-04-08 08:16:25 +00:00
|
|
|
((installer-parameters-menu current-installer)
|
2020-03-30 10:24:56 +00:00
|
|
|
(lambda ()
|
2020-04-08 08:16:25 +00:00
|
|
|
((installer-parameters-page current-installer)
|
2020-03-30 10:24:56 +00:00
|
|
|
(lambda _
|
2020-04-08 08:16:25 +00:00
|
|
|
(#$(compute-keymap-step 'param)
|
2020-03-30 10:24:56 +00:00
|
|
|
current-installer)))))
|
2018-11-24 03:25:03 +00:00
|
|
|
(list
|
2018-12-05 05:55:03 +00:00
|
|
|
;; Ask the user to choose a locale among those supported by
|
|
|
|
;; the glibc. Install the selected locale right away, so that
|
|
|
|
;; the user may benefit from any available translation for the
|
|
|
|
;; installer messages.
|
2018-11-24 03:25:03 +00:00
|
|
|
(installer-step
|
|
|
|
(id 'locale)
|
2018-12-05 05:30:16 +00:00
|
|
|
(description (G_ "Locale"))
|
2018-11-24 03:25:03 +00:00
|
|
|
(compute (lambda _
|
2018-12-05 05:30:16 +00:00
|
|
|
(#$locale-step current-installer)))
|
|
|
|
(configuration-formatter locale->configuration))
|
2018-11-24 03:25:03 +00:00
|
|
|
|
2019-04-07 14:16:14 +00:00
|
|
|
;; Welcome the user and ask them to choose between manual
|
|
|
|
;; installation and graphical install.
|
|
|
|
(installer-step
|
|
|
|
(id 'welcome)
|
|
|
|
(compute (lambda _
|
|
|
|
((installer-welcome-page current-installer)
|
|
|
|
#$(local-file "installer/aux-files/logo.txt")))))
|
|
|
|
|
2018-11-24 03:25:03 +00:00
|
|
|
;; Ask the user to select a timezone under glibc format.
|
|
|
|
(installer-step
|
|
|
|
(id 'timezone)
|
2018-12-05 05:30:16 +00:00
|
|
|
(description (G_ "Timezone"))
|
2018-11-24 03:25:03 +00:00
|
|
|
(compute (lambda _
|
|
|
|
((installer-timezone-page current-installer)
|
2018-12-05 05:30:16 +00:00
|
|
|
#$timezone-data)))
|
|
|
|
(configuration-formatter posix-tz->configuration))
|
2018-11-24 03:25:03 +00:00
|
|
|
|
|
|
|
;; The installer runs in a kmscon virtual terminal where loadkeys
|
|
|
|
;; won't work. kmscon uses libxkbcommon as a backend for keyboard
|
2020-04-09 00:17:22 +00:00
|
|
|
;; input. It is possible to update kmscon current keymap by sending
|
|
|
|
;; it a keyboard model, layout, variant and options, in a somehow
|
|
|
|
;; similar way as what is done with setxkbmap utility.
|
2018-11-24 03:25:03 +00:00
|
|
|
;;
|
|
|
|
;; So ask for a keyboard model, layout and variant to update the
|
2020-04-09 00:17:22 +00:00
|
|
|
;; current kmscon keymap. For non-Latin layouts, we add an
|
|
|
|
;; appropriate second layout and toggle via Alt+Shift.
|
2018-11-24 03:25:03 +00:00
|
|
|
(installer-step
|
|
|
|
(id 'keymap)
|
|
|
|
(description (G_ "Keyboard mapping selection"))
|
|
|
|
(compute (lambda _
|
2020-03-30 10:24:56 +00:00
|
|
|
(#$(compute-keymap-step 'default)
|
|
|
|
current-installer)))
|
2019-03-25 22:21:08 +00:00
|
|
|
(configuration-formatter keyboard-layout->configuration))
|
2018-11-24 03:25:03 +00:00
|
|
|
|
|
|
|
;; Ask the user to input a hostname for the system.
|
|
|
|
(installer-step
|
|
|
|
(id 'hostname)
|
2018-12-05 05:30:16 +00:00
|
|
|
(description (G_ "Hostname"))
|
2018-11-24 03:25:03 +00:00
|
|
|
(compute (lambda _
|
2018-12-05 05:30:16 +00:00
|
|
|
((installer-hostname-page current-installer))))
|
|
|
|
(configuration-formatter hostname->configuration))
|
2018-11-24 03:25:03 +00:00
|
|
|
|
|
|
|
;; Provide an interface above connmanctl, so that the user can select
|
|
|
|
;; a network susceptible to acces Internet.
|
|
|
|
(installer-step
|
|
|
|
(id 'network)
|
|
|
|
(description (G_ "Network selection"))
|
|
|
|
(compute (lambda _
|
|
|
|
((installer-network-page current-installer)))))
|
|
|
|
|
|
|
|
;; Prompt for users (name, group and home directory).
|
|
|
|
(installer-step
|
2018-12-05 05:30:16 +00:00
|
|
|
(id 'user)
|
|
|
|
(description (G_ "User creation"))
|
|
|
|
(compute (lambda _
|
|
|
|
((installer-user-page current-installer))))
|
|
|
|
(configuration-formatter users->configuration))
|
|
|
|
|
2018-12-05 05:41:48 +00:00
|
|
|
;; Ask the user to choose one or many desktop environment(s).
|
|
|
|
(installer-step
|
|
|
|
(id 'services)
|
|
|
|
(description (G_ "Services"))
|
2018-11-24 03:25:03 +00:00
|
|
|
(compute (lambda _
|
2018-12-05 05:41:48 +00:00
|
|
|
((installer-services-page current-installer))))
|
2020-03-28 17:40:41 +00:00
|
|
|
(configuration-formatter system-services->configuration))
|
2018-12-05 05:30:16 +00:00
|
|
|
|
2019-06-08 02:14:02 +00:00
|
|
|
;; Run a partitioning tool allowing the user to modify
|
|
|
|
;; partition tables, partitions and their mount points.
|
|
|
|
;; Do this last so the user has something to boot if any
|
|
|
|
;; of the previous steps didn't go as expected.
|
|
|
|
(installer-step
|
|
|
|
(id 'partition)
|
|
|
|
(description (G_ "Partitioning"))
|
|
|
|
(compute (lambda _
|
|
|
|
((installer-partition-page current-installer))))
|
|
|
|
(configuration-formatter user-partitions->configuration))
|
|
|
|
|
2020-03-28 17:40:41 +00:00
|
|
|
(installer-step
|
2018-12-05 05:30:16 +00:00
|
|
|
(id 'final)
|
|
|
|
(description (G_ "Configuration file"))
|
|
|
|
(compute
|
|
|
|
(lambda (result prev-steps)
|
|
|
|
((installer-final-page current-installer)
|
2018-12-05 05:41:48 +00:00
|
|
|
result prev-steps))))))))
|
2018-11-24 03:25:03 +00:00
|
|
|
|
2020-01-22 21:51:20 +00:00
|
|
|
(define guile-newt
|
|
|
|
;; Guile-Newt with 'form-watch-fd'.
|
|
|
|
;; TODO: Remove once a new release is out.
|
2020-03-30 10:24:56 +00:00
|
|
|
(let ((commit "c3cdeb0b53ac71aedabee669f57d44563c662446")
|
|
|
|
(revision "2"))
|
2020-01-22 21:51:20 +00:00
|
|
|
(package
|
|
|
|
(inherit (@ (gnu packages guile-xyz) guile-newt))
|
|
|
|
(name "guile-newt")
|
|
|
|
(version (git-version "0.0.1" revision commit))
|
|
|
|
(source (origin
|
|
|
|
(method git-fetch)
|
|
|
|
(uri (git-reference
|
|
|
|
(url "https://gitlab.com/mothacehe/guile-newt")
|
|
|
|
(commit commit)))
|
|
|
|
(file-name (git-file-name name version))
|
|
|
|
(sha256
|
|
|
|
(base32
|
2020-03-30 10:24:56 +00:00
|
|
|
"1gksd1lzgjjh1p9vczghg8jw995d22hm34kbsiv8rcryirv2xy09")))))))
|
2020-01-22 21:51:20 +00:00
|
|
|
|
2018-11-24 03:25:03 +00:00
|
|
|
(define (installer-program)
|
|
|
|
"Return a file-like object that runs the given INSTALLER."
|
|
|
|
(define init-gettext
|
|
|
|
;; Initialize gettext support, so that installer messages can be
|
|
|
|
;; translated.
|
|
|
|
#~(begin
|
|
|
|
(bindtextdomain "guix" (string-append #$guix "/share/locale"))
|
|
|
|
(textdomain "guix")))
|
|
|
|
|
|
|
|
(define set-installer-path
|
|
|
|
;; Add the specified binary to PATH for later use by the installer.
|
|
|
|
#~(let* ((inputs
|
2019-12-31 08:56:51 +00:00
|
|
|
'#$(list bash ;start subshells
|
|
|
|
connman ;call connmanctl
|
|
|
|
cryptsetup
|
|
|
|
dosfstools ;mkfs.fat
|
|
|
|
e2fsprogs ;mkfs.ext4
|
|
|
|
btrfs-progs
|
|
|
|
jfsutils ;jfs_mkfs
|
|
|
|
kbd ;chvt
|
|
|
|
guix ;guix system init call
|
|
|
|
util-linux ;mkwap
|
|
|
|
shadow
|
|
|
|
coreutils)))
|
2018-11-24 03:25:03 +00:00
|
|
|
(with-output-to-port (%make-void-port "w")
|
|
|
|
(lambda ()
|
|
|
|
(set-path-environment-variable "PATH" '("bin" "sbin") inputs)))))
|
|
|
|
|
|
|
|
(define steps (installer-steps))
|
2018-12-05 05:57:28 +00:00
|
|
|
(define modules
|
|
|
|
(scheme-modules*
|
|
|
|
(string-append (current-source-directory) "/..")
|
|
|
|
"gnu/installer"))
|
2018-11-24 03:25:03 +00:00
|
|
|
|
|
|
|
(define installer-builder
|
2019-03-26 22:06:51 +00:00
|
|
|
;; Note: Include GUIX as an extension to get all the (gnu system …), (gnu
|
|
|
|
;; packages …), etc. modules.
|
2018-12-05 05:57:28 +00:00
|
|
|
(with-extensions (list guile-gcrypt guile-newt
|
|
|
|
guile-parted guile-bytestructures
|
2019-07-21 21:05:54 +00:00
|
|
|
guile-json-3 guile-git guix)
|
2018-11-24 03:25:03 +00:00
|
|
|
(with-imported-modules `(,@(source-module-closure
|
2018-12-05 05:57:28 +00:00
|
|
|
`(,@modules
|
2019-04-26 12:08:39 +00:00
|
|
|
(gnu services herd)
|
2018-11-24 03:25:03 +00:00
|
|
|
(guix build utils))
|
2019-03-26 22:06:51 +00:00
|
|
|
#:select? module-to-import?)
|
2018-11-24 03:25:03 +00:00
|
|
|
((guix config) => ,(make-config.scm)))
|
|
|
|
#~(begin
|
|
|
|
(use-modules (gnu installer record)
|
|
|
|
(gnu installer keymap)
|
|
|
|
(gnu installer steps)
|
2018-12-05 05:30:16 +00:00
|
|
|
(gnu installer final)
|
2018-12-05 05:45:53 +00:00
|
|
|
(gnu installer hostname)
|
2018-11-24 03:25:03 +00:00
|
|
|
(gnu installer locale)
|
2018-12-05 05:30:16 +00:00
|
|
|
(gnu installer parted)
|
|
|
|
(gnu installer services)
|
|
|
|
(gnu installer timezone)
|
|
|
|
(gnu installer user)
|
2018-11-24 03:25:03 +00:00
|
|
|
(gnu installer newt)
|
2019-03-25 22:21:08 +00:00
|
|
|
((gnu installer newt keymap)
|
|
|
|
#:select (keyboard-layout->configuration))
|
2019-04-12 15:13:26 +00:00
|
|
|
(gnu services herd)
|
2018-11-24 03:25:03 +00:00
|
|
|
(guix i18n)
|
|
|
|
(guix build utils)
|
2019-05-14 12:05:36 +00:00
|
|
|
((system repl debug)
|
|
|
|
#:select (terminal-width))
|
2018-11-24 03:25:03 +00:00
|
|
|
(ice-9 match))
|
|
|
|
|
|
|
|
;; Initialize gettext support so that installers can use
|
|
|
|
;; (guix i18n) module.
|
|
|
|
#$init-gettext
|
|
|
|
|
|
|
|
;; Add some binaries used by the installers to PATH.
|
|
|
|
#$set-installer-path
|
|
|
|
|
2019-04-17 09:07:21 +00:00
|
|
|
;; Arrange for language and territory name translations to be
|
|
|
|
;; available. We need them at run time, not just compile time,
|
|
|
|
;; because some territories have several corresponding languages
|
|
|
|
;; (e.g., "French" is always displayed as "français", but
|
|
|
|
;; "Belgium" could be translated to Dutch, French, or German.)
|
|
|
|
(bindtextdomain "iso_639-3" ;languages
|
|
|
|
#+(file-append iso-codes "/share/locale"))
|
|
|
|
(bindtextdomain "iso_3166-1" ;territories
|
|
|
|
#+(file-append iso-codes "/share/locale"))
|
|
|
|
|
2019-04-17 13:11:21 +00:00
|
|
|
;; Likewise for XKB keyboard layout names.
|
|
|
|
(bindtextdomain "xkeyboard-config"
|
|
|
|
#+(file-append xkeyboard-config "/share/locale"))
|
|
|
|
|
2019-05-14 12:05:36 +00:00
|
|
|
;; Initialize 'terminal-width' in (system repl debug)
|
|
|
|
;; to a large-enough value to make backtrace more
|
|
|
|
;; verbose.
|
|
|
|
(terminal-width 200)
|
|
|
|
|
2018-12-05 05:30:16 +00:00
|
|
|
(let* ((current-installer newt-installer)
|
|
|
|
(steps (#$steps current-installer)))
|
2018-11-24 03:25:03 +00:00
|
|
|
((installer-init current-installer))
|
|
|
|
|
|
|
|
(catch #t
|
|
|
|
(lambda ()
|
2019-04-26 12:08:39 +00:00
|
|
|
(define results
|
|
|
|
(run-installer-steps
|
|
|
|
#:rewind-strategy 'menu
|
|
|
|
#:menu-proc (installer-menu-page current-installer)
|
|
|
|
#:steps steps))
|
|
|
|
|
|
|
|
(match (result-step results 'final)
|
|
|
|
('success
|
|
|
|
;; We did it! Let's reboot!
|
|
|
|
(sync)
|
|
|
|
(stop-service 'root))
|
2020-02-10 13:47:56 +00:00
|
|
|
(_
|
|
|
|
;; The installation failed, exit so that it is restarted
|
|
|
|
;; by login.
|
2019-04-26 12:08:39 +00:00
|
|
|
#f)))
|
2018-11-24 03:25:03 +00:00
|
|
|
(const #f)
|
|
|
|
(lambda (key . args)
|
2020-02-19 11:08:40 +00:00
|
|
|
(syslog "crashing due to uncaught exception: ~s ~s~%"
|
|
|
|
key args)
|
2018-12-06 02:11:04 +00:00
|
|
|
(let ((error-file "/tmp/last-installer-error"))
|
|
|
|
(call-with-output-file error-file
|
|
|
|
(lambda (port)
|
|
|
|
(display-backtrace (make-stack #t) port)
|
|
|
|
(print-exception port
|
|
|
|
(stack-ref (make-stack #t) 1)
|
|
|
|
key args)))
|
|
|
|
((installer-exit-error current-installer)
|
|
|
|
error-file key args))
|
2018-12-05 05:30:16 +00:00
|
|
|
(primitive-exit 1)))
|
|
|
|
|
|
|
|
((installer-exit current-installer)))))))
|
2018-11-16 11:43:55 +00:00
|
|
|
|
2018-11-24 05:06:40 +00:00
|
|
|
(program-file
|
|
|
|
"installer"
|
|
|
|
#~(begin
|
|
|
|
;; Set the default locale to install unicode support. For
|
|
|
|
;; some reason, unicode support is not correctly installed
|
|
|
|
;; when calling this in 'installer-builder'.
|
|
|
|
(setenv "LANG" "en_US.UTF-8")
|
2019-04-26 10:07:31 +00:00
|
|
|
(execl #$(program-file "installer-real" installer-builder)
|
|
|
|
"installer-real"))))
|