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 @@ ...@@ -367,17 +367,16 @@
("uptime" . ,(current-time))))) ("uptime" . ,(current-time)))))
new-container)))) new-container))))
(define (start-container name env) (define %network-file-systems
(define (network-file-system mappings) ;; The list of <file-system> objects corresponding to bind-mounts required
(cond ;; for networking.
((null? mappings) '()) (filter-map (lambda (mapping)
(else (let ((fs (file-system-mapping->bind-mount mapping)))
(let ((fs (file-system-mapping->bind-mount (car mappings)))) (and (file-exists? (file-system-device fs))
(if (file-exists? (file-system-device fs)) fs)))
(append (list fs) %network-file-mappings))
(network-file-system (cdr mappings)))
(network-file-system (cdr mappings)))))))
(define (start-container name env)
(let* ((guile-version (if (null? env) (let* ((guile-version (if (null? env)
(guile-current-version->path) (guile-current-version->path)
(if (not (package-in-list->path env "guile")) (if (not (package-in-list->path env "guile"))
...@@ -401,15 +400,15 @@ ...@@ -401,15 +400,15 @@
notebook-info-key))))) notebook-info-key)))))
(root (string-append "/tmp/guix-kernel/container/" (root (string-append "/tmp/guix-kernel/container/"
name "-" (number->string session-id))) name "-" (number->string session-id)))
(fs (append (list %immutable-store (fs (cons* %immutable-store
(file-system (file-system
(device "/tmp/guix-kernel") (device "/tmp/guix-kernel")
(mount-point "/tmp/guix-kernel") (mount-point "/tmp/guix-kernel")
(type "none") (type "none")
(check? #f) (check? #f)
(flags '(bind-mount)))) (flags '(bind-mount)))
%container-file-systems (append %container-file-systems
(network-file-system %network-file-mappings)))) %network-file-systems))))
(mkdir-p root) (mkdir-p root)
(run-container root fs (run-container root fs
%namespaces 1 %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