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
;;; 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, 2017, 2018 Chris Marusich <cmmarusich@gmail.com>
;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
@ -33,6 +33,7 @@ (define-module (guix scripts system reconfigure)
#:use-module (guix modules)
#:use-module (guix monads)
#:use-module (guix store)
#:use-module ((guix self) #:select (make-config.scm))
#:use-module (ice-9 match)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-11)
@ -60,6 +61,14 @@ (define-module (guix scripts system reconfigure)
;;; 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)
"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
@ -67,9 +76,11 @@ (define* (switch-system-program os #:optional profile)
(program-file
"switch-to-system.scm"
(with-extensions (list guile-gcrypt)
(with-imported-modules (source-module-closure '((guix config)
(guix profiles)
(guix utils)))
(with-imported-modules `(,@(source-module-closure
'((guix profiles)
(guix utils))
#:select? not-config?)
((guix config) => ,(make-config.scm)))
#~(begin
(use-modules (guix config)
(guix profiles)
@ -184,10 +195,13 @@ (define (install-bootloader-program installer bootloader-package bootcfg
(program-file
"install-bootloader.scm"
(with-extensions (list guile-gcrypt)
(with-imported-modules (source-module-closure '((gnu build bootloader)
(gnu build install)
(guix store)
(guix utils)))
(with-imported-modules `(,@(source-module-closure
'((gnu build bootloader)
(gnu build install)
(guix store)
(guix utils))
#:select? not-config?)
((guix config) => ,(make-config.scm)))
#~(begin
(use-modules (gnu build bootloader)
(gnu build install)
@ -197,6 +211,7 @@ (define (install-bootloader-program installer bootloader-package bootcfg
(ice-9 binary-ports)
(srfi srfi-34)
(srfi srfi-35))
(let* ((gc-root (string-append #$target %gc-roots-directory "/bootcfg"))
(new-gc-root (string-append gc-root ".new")))
;; #$bootcfg has dependencies.