Commit 3531b335 authored by Ludovic Courtès's avatar Ludovic Courtès Committed by ROUBY Pierre-Antoine
Browse files

guix-kernel: Simplify container network file system handling.

* guix-jupyter-kernel.scm (%network-file-systems): New variable.
(start-container)[network-file-system]: Remove.
Use %NETWORK-FILE-SYSTEMS instead.
parent a2c3ca37
......@@ -367,17 +367,16 @@
("uptime" . ,(current-time)))))
new-container))))
(define (start-container name env)
(define (network-file-system mappings)
(cond
((null? mappings) '())
(else
(let ((fs (file-system-mapping->bind-mount (car mappings))))
(if (file-exists? (file-system-device fs))
(append (list fs)
(network-file-system (cdr mappings)))
(network-file-system (cdr mappings)))))))
(define %network-file-systems
;; The list of <file-system> objects corresponding to bind-mounts required
;; for networking.
(filter-map (lambda (mapping)
(let ((fs (file-system-mapping->bind-mount mapping)))
(and (file-exists? (file-system-device fs))
fs)))
%network-file-mappings))
(define (start-container name env)
(let* ((guile-version (if (null? env)
(guile-current-version->path)
(if (not (package-in-list->path env "guile"))
......@@ -401,15 +400,15 @@
notebook-info-key)))))
(root (string-append "/tmp/guix-kernel/container/"
name "-" (number->string session-id)))
(fs (append (list %immutable-store
(file-system
(device "/tmp/guix-kernel")
(mount-point "/tmp/guix-kernel")
(type "none")
(check? #f)
(flags '(bind-mount))))
%container-file-systems
(network-file-system %network-file-mappings))))
(fs (cons* %immutable-store
(file-system
(device "/tmp/guix-kernel")
(mount-point "/tmp/guix-kernel")
(type "none")
(check? #f)
(flags '(bind-mount)))
(append %container-file-systems
%network-file-systems))))
(mkdir-p root)
(run-container root fs
%namespaces 1
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment