summaryrefslogtreecommitdiff
path: root/guix/scripts/system.scm
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2015-05-18 07:49:44 -0400
committerDavid Thompson <dthompson2@worcester.edu>2015-05-20 12:13:04 -0400
commit7ea1432e22b42969ff0d078e68f5cb55a75b1aca (patch)
treebdf7b29e5743a670ad0b85421dd93610998a274b /guix/scripts/system.scm
parentd620ea889cd6ea75430258b613d729900f440abc (diff)
ui: Factorize user-provided Scheme file loading.
* guix/ui.scm (make-user-module, load*): New procedures. * guix/scripts/system.scm (%user-module): Define in terms of 'make-user-module'. (read-operating-system): Define in terms of load*'.
Diffstat (limited to 'guix/scripts/system.scm')
-rw-r--r--guix/scripts/system.scm22
1 files changed, 4 insertions, 18 deletions
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 1838e89452..459b2da0cc 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -48,28 +48,14 @@
(define %user-module
;; Module in which the machine description file is loaded.
- (let ((module (make-fresh-user-module)))
- (for-each (lambda (iface)
- (module-use! module (resolve-interface iface)))
- '((gnu system)
- (gnu services)
- (gnu system shadow)))
- module))
+ (make-user-module '((gnu system)
+ (gnu services)
+ (gnu system shadow))))
(define (read-operating-system file)
"Read the operating-system declaration from FILE and return it."
- ;; TODO: Factorize.
- (catch #t
- (lambda ()
- ;; Avoid ABI incompatibility with the <operating-system> record.
- (set! %fresh-auto-compile #t)
+ (load* file %user-module))
- (save-module-excursion
- (lambda ()
- (set-current-module %user-module)
- (primitive-load file))))
- (lambda args
- (report-load-error file args))))
;;;