guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/09: file-systems: Add '%network-configuration-files' and '%network-fi


From: Ludovic Courtès
Subject: 01/09: file-systems: Add '%network-configuration-files' and '%network-file-mappings'.
Date: Mon, 6 Feb 2017 23:08:27 +0000 (UTC)

civodul pushed a commit to branch master
in repository guix.

commit 7597478e2e731c09890b25ff0b817d2d7c45d01f
Author: Ludovic Courtès <address@hidden>
Date:   Mon Feb 6 15:42:00 2017 +0100

    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'.
---
 gnu/system/file-systems.scm  |   24 +++++++++++++++++++++++-
 guix/scripts/environment.scm |   23 +----------------------
 2 files changed, 24 insertions(+), 23 deletions(-)

diff --git a/gnu/system/file-systems.scm b/gnu/system/file-systems.scm
index 708d53d..7011a27 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
diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
index 0a1205d..44f4900 100644
--- a/guix/scripts/environment.scm
+++ b/guix/scripts/environment.scm
@@ -60,12 +60,6 @@ directories in PROFILE, the store path of a profile."
 (define %default-shell
   (or (getenv "SHELL") "/bin/sh"))
 
-(define %network-configuration-files
-  '("/etc/resolv.conf"
-    "/etc/nsswitch.conf"
-    "/etc/services"
-    "/etc/hosts"))
-
 (define (purify-environment)
   "Unset almost all environment variables.  A small number of variables such
 as 'HOME' and 'USER' are left untouched."
@@ -408,22 +402,7 @@ host file systems to mount inside the container."
                      ;; When in Rome, do as Nix build.cc does: Automagically
                      ;; map common network configuration files.
                      (if network?
-                         (filter-map (lambda (file)
-                                       (and (file-exists? 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)
+                         %network-file-mappings
                          '())
                      ;; Mappings for the union closure of all inputs.
                      (map (lambda (dir)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]