guix system: Do not import the user's (guix config).

Previously, 'switch-to-system.drv' and 'install-bootloader.drv' would
depend on the user's (guix config) module.  This is no longer the case.

* guix/scripts/system/reconfigure.scm (not-config?): New procedure.
(switch-system-program): Do not import the user's (guix config).  Use
'make-config.scm' instead.
(install-bootloader-program): Likewise.
This commit is contained in:
Ludovic Courtès 2020-04-02 22:09:43 +02:00
parent efa578ecae
commit a6850f6827
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5

View File

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2016 Alex Kost <alezost@gmail.com> ;;; Copyright © 2016 Alex Kost <alezost@gmail.com>
;;; Copyright © 2016, 2017, 2018 Chris Marusich <cmmarusich@gmail.com> ;;; Copyright © 2016, 2017, 2018 Chris Marusich <cmmarusich@gmail.com>
;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com> ;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
@ -33,6 +33,7 @@
#:use-module (guix modules) #:use-module (guix modules)
#:use-module (guix monads) #:use-module (guix monads)
#:use-module (guix store) #:use-module (guix store)
#:use-module ((guix self) #:select (make-config.scm))
#:use-module (ice-9 match) #:use-module (ice-9 match)
#:use-module (srfi srfi-1) #:use-module (srfi srfi-1)
#:use-module (srfi srfi-11) #:use-module (srfi srfi-11)
@ -60,6 +61,14 @@
;;; Profile creation. ;;; Profile creation.
;;; ;;;
(define not-config?
;; Select (guix …) and (gnu …) modules, except (guix config).
(match-lambda
(('guix 'config) #f)
(('guix rest ...) #t)
(('gnu rest ...) #t)
(_ #f)))
(define* (switch-system-program os #:optional profile) (define* (switch-system-program os #:optional profile)
"Return an executable store item that, upon being evaluated, will create a "Return an executable store item that, upon being evaluated, will create a
new generation of PROFILE pointing to the directory of OS, switch to it new generation of PROFILE pointing to the directory of OS, switch to it
@ -67,9 +76,11 @@ atomically, and run OS's activation script."
(program-file (program-file
"switch-to-system.scm" "switch-to-system.scm"
(with-extensions (list guile-gcrypt) (with-extensions (list guile-gcrypt)
(with-imported-modules (source-module-closure '((guix config) (with-imported-modules `(,@(source-module-closure
(guix profiles) '((guix profiles)
(guix utils))) (guix utils))
#:select? not-config?)
((guix config) => ,(make-config.scm)))
#~(begin #~(begin
(use-modules (guix config) (use-modules (guix config)
(guix profiles) (guix profiles)
@ -184,10 +195,13 @@ BOOTLOADER-PACKAGE."
(program-file (program-file
"install-bootloader.scm" "install-bootloader.scm"
(with-extensions (list guile-gcrypt) (with-extensions (list guile-gcrypt)
(with-imported-modules (source-module-closure '((gnu build bootloader) (with-imported-modules `(,@(source-module-closure
(gnu build install) '((gnu build bootloader)
(guix store) (gnu build install)
(guix utils))) (guix store)
(guix utils))
#:select? not-config?)
((guix config) => ,(make-config.scm)))
#~(begin #~(begin
(use-modules (gnu build bootloader) (use-modules (gnu build bootloader)
(gnu build install) (gnu build install)
@ -197,6 +211,7 @@ BOOTLOADER-PACKAGE."
(ice-9 binary-ports) (ice-9 binary-ports)
(srfi srfi-34) (srfi srfi-34)
(srfi srfi-35)) (srfi srfi-35))
(let* ((gc-root (string-append #$target %gc-roots-directory "/bootcfg")) (let* ((gc-root (string-append #$target %gc-roots-directory "/bootcfg"))
(new-gc-root (string-append gc-root ".new"))) (new-gc-root (string-append gc-root ".new")))
;; #$bootcfg has dependencies. ;; #$bootcfg has dependencies.