Paste number 148862: guixsd container WIP

Paste number 148862: guixsd container WIP
Pasted by: davexunit
When:6 years, 6 months ago
Share:Tweet this! | http://paste.lisp.org/+36V2
Channel:None
Paste contents:
Raw Source | XML | Display As
;;; Hacky code below :)

(define system
  "/gnu/store/7aj9dkiwmvrvw5kjajg3qbj5c5qansys-system")

(define-syntax-rule (push! lst obj)
         (set! lst (cons obj lst)))

(define (run-guixsd)
  (symlink system "/run/current-system")
  (push! %load-path
         "/run/current-system/profile/share/guile/site/2.0")
  (push! %load-compiled-path
         "/run/current-system/profile/share/guile/site/2.0")
  (primitive-load "/run/current-system/boot"))

(define (delete-file-maybe file)
  (when (file-exists? file) (delete-file file)))

(let* ((root (string-append (getcwd) "/croot"))
       (store "/gnu/store")
       (store-target (string-append root "/gnu/store")))
  (mkdir-p store-target)
  (mkdir-p (string-append root "/bin"))
  (mkdir-p (string-append root "/etc"))
  (mkdir-p (string-append root "/home"))
  (delete-file-maybe (string-append root "/run/current-system"))
  (call-with-container root
                       (list (make-bind-mount-point store store-target
                                                    '(rdonly)))
                       run-guixsd))

This paste has no annotations.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.