about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/libexpr/download.cc2
-rw-r--r--tests/local.mk2
-rw-r--r--tests/tarball.sh20
3 files changed, 22 insertions, 2 deletions
diff --git a/src/libexpr/download.cc b/src/libexpr/download.cc
index 062622000dc2..9bf3e13aa9da 100644
--- a/src/libexpr/download.cc
+++ b/src/libexpr/download.cc
@@ -229,7 +229,7 @@ bool isUri(const string & s)
     size_t pos = s.find("://");
     if (pos == string::npos) return false;
     string scheme(s, 0, pos);
-    return scheme == "http" || scheme == "https";
+    return scheme == "http" || scheme == "https" || scheme == "file";
 }
 
 
diff --git a/tests/local.mk b/tests/local.mk
index 7a24fadcb8b9..03f53b44c275 100644
--- a/tests/local.mk
+++ b/tests/local.mk
@@ -11,7 +11,7 @@ nix_tests = \
   binary-patching.sh timeout.sh secure-drv-outputs.sh nix-channel.sh \
   multiple-outputs.sh import-derivation.sh fetchurl.sh optimise-store.sh \
   binary-cache.sh nix-profile.sh repair.sh dump-db.sh case-hack.sh \
-  check-reqs.sh pass-as-file.sh
+  check-reqs.sh pass-as-file.sh tarball.sh
   # parallel.sh
 
 install-tests += $(foreach x, $(nix_tests), tests/$(x))
diff --git a/tests/tarball.sh b/tests/tarball.sh
new file mode 100644
index 000000000000..6d02544cfae3
--- /dev/null
+++ b/tests/tarball.sh
@@ -0,0 +1,20 @@
+source common.sh
+
+clearStore
+
+tarroot=$TEST_ROOT/tarball
+rm -rf $tarroot
+mkdir -p $tarroot
+cp dependencies.nix $tarroot/default.nix
+cp config.nix dependencies.builder*.sh $tarroot/
+
+tarball=$TEST_ROOT/tarball.tar.xz
+(cd $TEST_ROOT && tar c tarball) | xz > $tarball
+
+nix-env -f file://$tarball -qa --out-path | grep -q dependencies
+
+nix-build file://$tarball
+
+nix-build '<foo>' -I foo=file://$tarball
+
+nix-build -E "import (fetchTarball file://$tarball)"