nongnu: installation-os-nonfree: Add prefilled channels.scm to install image.

Remove requirement to define 'nonguix channel on build system.

    * nongnu/system/install.scm (installation-os-nonfree): Add channels.scm to skeletons
%channels (%channels, %channels-file)
(inferior-channel, linux, linux-firmware ): Add variables.
This commit is contained in:
AAaronson 2021-04-26 10:56:29 +00:00
parent 9e912f2224
commit 7b073643e1

View File

@ -20,13 +20,73 @@
(define-module (nongnu system install)
#:use-module (gnu system)
#:use-module (gnu system install)
#:use-module (nongnu packages linux)
#:use-module (guix channels)
#:use-module (guix ci)
#:use-module (guix gexp)
#:use-module (guix inferior)
#:use-module (ice-9 pretty-print)
#:export (installation-os-nonfree))
; List of guix channels. Used in both inferior-channel and the
; "/etc/skel/.config/guix/channels.scm" definitions.
; %default-guix-channel is configured to pull package definitions from
; the Guix substitute server, to save compiling during a guix pull.
(define %channels
'(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)))
(pretty-print '(use-modules
(guix ci)) ; for channel-with-substitutes-availabe
port)
(pretty-print %channels
port)
(plain-file "channels.scm"
(get-output-string port))))
; inferior-for-channels allows for looking up packages WITHOUT a channel
; definition in place. Requires the 'guix channel as well so reuse of the
; %channels definition is done with eval.
(define inferior-channel
(inferior-for-channels
(eval %channels
(current-dynamic-state))))
(define linux ; latest linux package from inferior-channel
(car (lookup-inferior-packages inferior-channel
"linux")))
(define linux-firmware ; latest linux-firmware package from inferior-channel
(car (lookup-inferior-packages inferior-channel
"linux-firmware")))
; 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))))
(firmware (list linux-firmware))
(skeletons
(cons ; add "channels.scm" to the "~/.config/guix" folder
`(".config" ,(file-union "guix"
`(("guix/channels.scm" ,%channels-file))))
(operating-system-skeletons installation-os)))))
installation-os-nonfree