gnu: vm: Remove potluck hacks.

* gnu/system/vm.scm (example1): Remove.
  (example2): Rename to...
  (system-qemu-image): ... this.  Add 'store' parameter, and remove call
  to 'open-connection'.
master
Ludovic Courtès 2013-09-11 20:08:53 +02:00
parent a843fe2222
commit aedb72fbe0
1 changed files with 75 additions and 97 deletions

View File

@ -38,7 +38,8 @@
#:use-module (srfi srfi-26)
#:use-module (ice-9 match)
#:export (expression->derivation-in-linux-vm
qemu-image))
qemu-image
system-qemu-image))
;;; Commentary:
@ -342,26 +343,9 @@ It can be used to provide additional files, such as /etc files."
;;;
;;; Guile 2.0 potluck examples.
;;; Stand-alone VM image.
;;;
(define (example1)
(let ((store #f))
(dynamic-wind
(lambda ()
(set! store (open-connection)))
(lambda ()
(parameterize ((%guile-for-build (package-derivation store guile-final)))
(expression->derivation-in-linux-vm
store "vm-test"
'(begin
(display "hello from boot!\n")
(call-with-output-file "/xchg/hello"
(lambda (p)
(display "world" p)))))))
(lambda ()
(close-connection store)))))
(define* (passwd-file store accounts #:key shadow?)
"Return a password file for ACCOUNTS, a list of vectors as returned by
'getpwnam'. If SHADOW? is true, then it is a /etc/shadow file, otherwise it
@ -389,12 +373,8 @@ is a /etc/passwd file."
(add-text-to-store store (if shadow? "shadow" "passwd")
contents '()))
(define (example2)
(let ((store #f))
(dynamic-wind
(lambda ()
(set! store (open-connection)))
(lambda ()
(define (system-qemu-image store)
"Return the derivation of a QEMU image of the GNU system."
(define %pam-services
;; Services known to PAM.
(list %pam-other-services
@ -471,7 +451,5 @@ is a /etc/passwd file."
("etc-pam.d" ,pam.d)
("etc-passwd" ,passwd)
("etc-shadow" ,shadow))))))
(lambda ()
(close-connection store)))))
;;; vm.scm ends here