nonguix/nongnu/system/install.scm
AAaronson f9227ab655 * nongnu/system/install.scm
Refactored %channels-file creation to make build-image cleaner.

* nongnu/system/build-image.scm
Refactored make-tmp-channel to use mkstemp! and improved %channels-file.
Improved readability of build-image function.
2021-05-04 15:09:56 +00:00

74 lines
3.0 KiB
Scheme

;;; Copyright © 2019 Alex Griffin <a@ajgrf.com>
;;; Copyright © 2019 Pierre Neidhardt <mail@ambrevar.xyz>
;;; Copyright © 2021 Kyle Cassidy <123_kbc@pm.me>
;;;
;;; This program 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.
;;;
;;; This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
;; Generate a bootable image (e.g. for USB sticks, etc.) with:
;; $ guix system disk-image nongnu/system/install.scm
(define-module (nongnu system install)
#:use-module (gnu system)
#:use-module (gnu system install)
#:use-module (nongnu packages linux)
#:use-module (guix ci)
#:use-module (guix gexp)
#:use-module (ice-9 pretty-print)
#:export (installation-os-nonfree))
; Guix channel for the "/etc/skel/.config/guix/channels.scm" file.
; %default-guix-channel is configured to pull package definitions from
; the Guix substitute server, to save compiling during a guix pull.
(define nonguix-channels
'((use-modules (guix ci)) ; required for channel-with-substitutes-available
(list (channel
(name 'nonguix)
(url "https://gitlab.com/nonguix/nonguix")
(introduction
(make-channel-introduction
"897c1a470da759236cc11798f4e0a5f7d4d59fbc"
(openpgp-fingerprint
"2A39 3FFF 68F4 EF7A 3D29 12AF 6F51 20A0 22FB B2D5"))))
(channel-with-substitutes-available
%default-guix-channel
"https://ci.guix.gnu.org"))))
; Create the plain-file definition of "channels.scm" to add to the install.
(define %channels-file
(let ((port (open-output-string)))
(map (lambda (_) (pretty-print _ port))
nonguix-channels)
(plain-file "channels.scm"
(get-output-string port))))
; Currently the best way to add the "channels.scm" file to the install is via
; the skeletons record type.
; The following service definition for the global channel file is also viable:
; (service special-files-service-type
; `(("/etc/guix/channels.scm" ,%channel-file)))
; However even when using (operating-system-services installation-os) without
; modifying it, a "more than one target service of type 'account" error occurs.
(define installation-os-nonfree
(operating-system
(inherit installation-os)
(kernel linux)
(firmware (list linux-firmware))
(skeletons
(cons ; adds "channels.scm" to "/etc/skel/.config/guix/"
`(".config" ,(file-union "guix"
`(("guix/channels.scm" ,%channels-file))))
(operating-system-skeletons installation-os)))))
installation-os-nonfree