M gnu/system/file-systems.scm => gnu/system/file-systems.scm +14 -1
@@ 19,7 19,6 @@
(define-module (gnu system file-systems)
#:use-module (ice-9 match)
#:use-module (guix records)
- #:use-module (guix store)
#:use-module ((gnu build file-systems)
#:select (string->uuid uuid->string))
#:re-export (string->uuid
@@ 97,6 96,20 @@
(dependencies file-system-dependencies ; list of <file-system>
(default '()))) ; or <mapped-device>
+;; Note: This module is used both on the build side and on the host side.
+;; Arrange not to pull (guix store) and (guix config) because the latter
+;; differs from user to user.
+(define (%store-prefix)
+ "Return the store prefix."
+ (cond ((resolve-module '(guix store) #:ensure #f)
+ =>
+ (lambda (store)
+ ((module-ref store '%store-prefix))))
+ ((getenv "NIX_STORE")
+ => identity)
+ (else
+ "/gnu/store")))
+
(define %not-slash
(char-set-complement (char-set #\/)))
M tests/file-systems.scm => tests/file-systems.scm +8 -0
@@ 18,6 18,7 @@
(define-module (test-file-systems)
#:use-module (guix store)
+ #:use-module (guix modules)
#:use-module (gnu system file-systems)
#:use-module (srfi srfi-64)
#:use-module (rnrs bytevectors))
@@ 72,4 73,11 @@
(device "/foo")
(flags '(bind-mount read-only)))))))))
+(test-assert "does not pull (guix config)"
+ ;; This module is meant both for the host side and "build side", so make
+ ;; sure it doesn't pull in (guix config), which depends on the user's
+ ;; config.
+ (not (member '(guix config)
+ (source-module-closure '((gnu system file-systems))))))
+
(test-end)