summary refs log tree commit diff
path: root/gnu/system
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-02-06 15:42:00 +0100
committerLudovic Courtès <ludo@gnu.org>2017-02-07 00:08:10 +0100
commit7597478e2e731c09890b25ff0b817d2d7c45d01f (patch)
treea18d8348cbf417a05dc94a5f2240fea80979687f /gnu/system
parenta24fda8114eb49595adb6f08bdb44da0a135e0cd (diff)
downloadguix-7597478e2e731c09890b25ff0b817d2d7c45d01f.tar.gz
file-systems: Add '%network-configuration-files' and '%network-file-mappings'.
* gnu/system/file-systems.scm (%network-configuration-files)
(%network-file-mappings): New variables.
* guix/scripts/environment.scm (%network-configuration-files): Remove.
(launch-environment/container): Refer to '%network-file-mappings'
instead of calling 'filter-map'.
Diffstat (limited to 'gnu/system')
-rw-r--r--gnu/system/file-systems.scm24
1 files changed, 23 insertions, 1 deletions
diff --git a/gnu/system/file-systems.scm b/gnu/system/file-systems.scm
index 708d53d0a1..7011a279d3 100644
--- a/gnu/system/file-systems.scm
+++ b/gnu/system/file-systems.scm
@@ -18,6 +18,7 @@
 
 (define-module (gnu system file-systems)
   #:use-module (ice-9 match)
+  #:use-module (srfi srfi-1)
   #:use-module (guix records)
   #:use-module ((gnu build file-systems)
                 #:select (string->uuid uuid->string))
@@ -64,7 +65,9 @@
 
             file-system-mapping->bind-mount
 
-            %store-mapping))
+            %store-mapping
+            %network-configuration-files
+            %network-file-mappings))
 
 ;;; Commentary:
 ;;;
@@ -389,4 +392,23 @@ a bind mount."
    (target (%store-prefix))
    (writable? #f)))
 
+(define %network-configuration-files
+  ;; List of essential network configuration files.
+  '("/etc/resolv.conf"
+    "/etc/nsswitch.conf"
+    "/etc/services"
+    "/etc/hosts"))
+
+(define %network-file-mappings
+  ;; List of file mappings for essential network files.
+  (filter-map (lambda (file)
+                (file-system-mapping
+                 (source file)
+                 (target file)
+                 ;; XXX: On some GNU/Linux systems, /etc/resolv.conf is a
+                 ;; symlink to a file in a tmpfs which, for an unknown reason,
+                 ;; cannot be bind mounted read-only within the container.
+                 (writable? (string=? file "/etc/resolv.conf"))))
+              %network-configuration-files))
+
 ;;; file-systems.scm ends here