file-systems: Remove dependency on (guix store).

(gnu system file-systems) is used on the "build" side since commit
5970e8e248.

* gnu/system/file-systems.scm: Remove dependency on (guix store).
(%store-prefix): New procedure.
* tests/file-systems.scm ("does not pull (guix config)"): New test.
This commit is contained in:
Ludovic Courtès 2017-02-03 11:26:25 +01:00
parent cf98d342b0
commit ad167d028e
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
2 changed files with 22 additions and 1 deletions

View File

@ -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 #\/)))

View File

@ -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)