;;; Copyright © 2019 Alex Griffin ;;; Copyright © 2019 Pierre Neidhardt ;;; ;;; 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 . ;; 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 (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)) (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