From ed11b17b2e0e10b759ac051b53c29cc9f79574dc Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 30 Dec 2011 13:43:29 +0000 Subject: [PATCH 1/8] * Fix doc error. --- doc/manual/nix-prefetch-url.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/manual/nix-prefetch-url.xml b/doc/manual/nix-prefetch-url.xml index b31b699af..0d953e946 100644 --- a/doc/manual/nix-prefetch-url.xml +++ b/doc/manual/nix-prefetch-url.xml @@ -12,7 +12,7 @@ nix-prefetch-url - copy a file from a URL into the store and print its MD5 hash + copy a file from a URL into the store and print its hash From f2d65c9c80821616c4f5587d2bbfdec9e18bdbfd Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 30 Dec 2011 17:31:58 +0000 Subject: [PATCH 2/8] * Remove a redundant dot (Nicolas Pierron). --- doc/manual/writing-nix-expressions.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/manual/writing-nix-expressions.xml b/doc/manual/writing-nix-expressions.xml index 35fdf535b..58b5a1ed0 100644 --- a/doc/manual/writing-nix-expressions.xml +++ b/doc/manual/writing-nix-expressions.xml @@ -982,7 +982,7 @@ map (concat "foo") ["bar" "bla" "abc"] (...): -{x, y, z, ....}: z + y + x +{x, y, z, ...}: z + y + x This works on any set that contains at least the three named attributes. From 93e71e6ab68d9662441289a02448c47069beeb2a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 30 Dec 2011 17:39:03 +0000 Subject: [PATCH 3/8] * Follow our own coding conventions. --- doc/manual/builtins.xml | 38 ++++++------ doc/manual/opt-common.xml | 4 +- doc/manual/writing-nix-expressions.xml | 82 ++++++++++++-------------- 3 files changed, 60 insertions(+), 64 deletions(-) diff --git a/doc/manual/builtins.xml b/doc/manual/builtins.xml index c7ebcc9a3..ce68c45bf 100644 --- a/doc/manual/builtins.xml +++ b/doc/manual/builtins.xml @@ -43,10 +43,10 @@ is also available as builtins.derivation. Return the names of the attributes in the attribute set attrs in a sorted list. - For instance, builtins.attrNames {y = 1; x = - "foo";} evaluates to ["x" "y"]. - There is no built-in function attrValues, but - you can easily define it yourself: + For instance, builtins.attrNames { y = 1; x = "foo"; + } evaluates to [ "x" "y" ]. There is + no built-in function attrValues, but you can + easily define it yourself: attrValues = attrs: map (name: builtins.getAttr name attrs) (builtins.attrNames attrs); @@ -442,10 +442,10 @@ x: x + 456 Example: -builtins.listToAttrs [ - {name = "foo"; value = 123;} - {name = "bar"; value = 456;} -] +builtins.listToAttrs + [ { name = "foo"; value = 123; } + { name = "bar"; value = 456; } + ] evaluates to @@ -466,10 +466,10 @@ builtins.listToAttrs [ example, -map (x: "foo" + x) ["bar" "bla" "abc"] +map (x: "foo" + x) [ "bar" "bla" "abc" ] - evaluates to ["foobar" "foobla" - "fooabc"]. + evaluates to [ "foobar" "foobla" "fooabc" + ]. @@ -491,10 +491,10 @@ map (x: "foo" + x) ["bar" "bla" "abc"] a package name and version. The package name is everything up to but not including the first dash followed by a digit, and the version is everything following that dash. The result is returned - in an attribute set {name, version}. Thus, + in an attribute set { name, version }. Thus, builtins.parseDrvName "nix-0.12pre12876" - returns {name = "nix"; version = - "0.12pre12876";}. + returns { name = "nix"; version = "0.12pre12876"; + }. @@ -550,9 +550,9 @@ in config.someSetting exist in attrs. For instance, -removeAttrs { x = 1; y = 2; z = 3; } ["a" "x" "z"] +removeAttrs { x = 1; y = 2; z = 3; } [ "a" "x" "z" ] - evaluates to {y = 2;}. + evaluates to { y = 2; }. @@ -632,7 +632,7 @@ removeAttrs { x = 1; y = 2; z = 3; } ["a" "x" "z"] linkend='ex-hello-builder' /> into one file: -{stdenv, fetchurl, perl}: +{ stdenv, fetchurl, perl }: stdenv.mkDerivation { name = "hello-2.1.1"; @@ -765,12 +765,12 @@ in foo using toXML default value - (e.g., {argName ? - defaultValue}: + (e.g., { argName ? + defaultValue }: ...). With , you can also call functions that have arguments without a default value (or override a default value). diff --git a/doc/manual/writing-nix-expressions.xml b/doc/manual/writing-nix-expressions.xml index 58b5a1ed0..e16225433 100644 --- a/doc/manual/writing-nix-expressions.xml +++ b/doc/manual/writing-nix-expressions.xml @@ -52,7 +52,7 @@ need to do three things: Nix expression for GNU Hello (<filename>default.nix</filename>) -{stdenv, fetchurl, perl}: +{ stdenv, fetchurl, perl }: stdenv.mkDerivation { name = "hello-2.1.1"; @@ -92,8 +92,8 @@ the single Nix expression in that directory function that downloads files. perl is the Perl interpreter. - Nix functions generally have the form {x, y, ..., - z}: e where x, y, + Nix functions generally have the form { x, y, ..., + z }: e where x, y, etc. are the names of the expected arguments, and where e is the body of the function. So here, the entire remainder of the file is the body of the @@ -114,10 +114,10 @@ the single Nix expression in that directory attributes. An attribute set is just a list of key/value pairs where each value is an arbitrary Nix expression. They take the general form - {name1 = + { name1 = expr1; ... nameN = - exprN;}. + exprN; }. @@ -564,7 +564,7 @@ genericBuild expression, like this: - buildInputs = [perl]; + buildInputs = [ perl ]; The perl attribute can then be removed, and the builder becomes even shorter: @@ -771,14 +771,14 @@ stdenv.mkDerivation { values between square brackets. For example, -[ 123 ./foo.nix "abc" (f {x=y;}) ] +[ 123 ./foo.nix "abc" (f { x = y; }) ] defines a list of four elements, the last being the result of a call to the function f. Note that function calls have to be enclosed in parentheses. If they had been omitted, e.g., -[ 123 ./foo.nix "abc" f {x=y;} ] +[ 123 ./foo.nix "abc" f { x = y; } ] the result would be a list of five elements, the fourth one being a function and the fifth being an attribute set. @@ -891,15 +891,12 @@ propagate attributes). This can be shortened using the inherit keyword. For instance, -let - x = 123; -in - { - inherit x; - y = 456; - } +let x = 123; in +{ inherit x; + y = 456; +} -evaluates to {x = 123; y = 456;}. (Note that this +evaluates to { x = 123; y = 456; }. (Note that this works because x is added to the lexical scope by the let construct.) It is also possible to inherit attributes from another attribute set. For instance, in this fragment @@ -960,20 +957,20 @@ in if negate true then concat "foo" "bar" else "" arguments of a function); e.g., -map (concat "foo") ["bar" "bla" "abc"] +map (concat "foo") [ "bar" "bla" "abc" ] - evaluates to ["foobar" "foobla" - "fooabc"]. + evaluates to [ "foobar" "foobla" + "fooabc" ]. An attribute set pattern of the - form {name1, name2, …, nameN} + form { name1, name2, …, nameN } matches an attribute set containing the listed attributes, and binds the values of those attributes to variables in the function body. For example, the function -{x, y, z}: z + y + x +{ x, y, z }: z + y + x can only be called with a set containing exactly the attributes x, y and @@ -982,7 +979,7 @@ map (concat "foo") ["bar" "bla" "abc"] (...): -{x, y, z, ...}: z + y + x +{ x, y, z, ... }: z + y + x This works on any set that contains at least the three named attributes. @@ -995,7 +992,7 @@ map (concat "foo") ["bar" "bla" "abc"] e is an arbitrary expression. For example, -{x, y ? "foo", z ? "bar"}: z + y + x +{ x, y ? "foo", z ? "bar" }: z + y + x specifies a function that only requires an attribute named x, but optionally accepts y @@ -1007,11 +1004,11 @@ map (concat "foo") ["bar" "bla" "abc"] of the @-sign. For example: -args@{x, y, z, ...}: z + y + x + args.a +args@{ x, y, z, ... }: z + y + x + args.a Here args is bound to the entire argument, which - is further matches against the pattern {x, y, z, - ...}. + is further matches against the pattern { x, y, z, + ... }. @@ -1020,8 +1017,8 @@ args@{x, y, z, ...}: z + y + x + args.a a name, you can bind them to an attribute, e.g., -let concat = {x, y}: x + y; -in concat {x = "foo"; y = "bar";} +let concat = { x, y }: x + y; +in concat { x = "foo"; y = "bar"; } @@ -1142,7 +1139,7 @@ lexical scope of the expression e2. For instance, -let as = {x = "foo"; y = "bar";}; +let as = { x = "foo"; y = "bar"; }; in with as; x + y evaluates to "foobar" since the @@ -1480,21 +1477,20 @@ allowedReferences = []; references graph of their inputs. The attribute is a list of inputs in the Nix store whose references graph the builder needs to know. The value of this attribute should be a list of pairs - [name1 + [ name1 path1 name2 - path2 - ...]. The references graph - of each pathN will be stored in a text - file nameN in the temporary build - directory. The text files have the format used by - nix-store --register-validity (with the deriver - fields left empty). For example, when the following derivation is - built: + path2 ... + ]. The references graph of each + pathN will be stored in a text file + nameN in the temporary build directory. + The text files have the format used by nix-store + --register-validity (with the deriver fields left + empty). For example, when the following derivation is built: derivation { ... - exportReferencesGraph = ["libfoo-graph" libfoo]; + exportReferencesGraph = [ "libfoo-graph" libfoo ]; }; @@ -1571,14 +1567,14 @@ fetchurl { fetchurl: -{stdenv, curl}: # The curl program is used for downloading. +{ stdenv, curl }: # The curl program is used for downloading. -{url, md5}: +{ url, md5 }: stdenv.mkDerivation { name = baseNameOf (toString url); builder = ./builder.sh; - buildInputs = [curl]; + buildInputs = [ curl ]; # This is a fixed-output derivation; the output must be a regular # file with MD5 hash md5. @@ -1650,7 +1646,7 @@ stdenv.mkDerivation { Nixpkgs has the line -impureEnvVars = ["http_proxy" "https_proxy" ...]; +impureEnvVars = [ "http_proxy" "https_proxy" ... ]; to make it use the proxy server configuration specified by the From 48cea0d01ef48733ab38a73a20611f63aeb1b5cc Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 3 Jan 2012 00:16:29 +0000 Subject: [PATCH 4/8] * Refactoring: Get rid of a few subdirectories in corepkgs/, and some other simplifications. * Use to locate the corepkgs. This allows them to be overriden through $NIX_PATH. * Use bash's pipefail option in the NAR builder so that we don't need to create a temporary file. --- corepkgs/Makefile.am | 12 +++++++- .../{buildenv/default.nix => buildenv.nix} | 7 +++-- .../{buildenv/builder.pl.in => buildenv.pl} | 2 -- corepkgs/buildenv/Makefile.am | 11 ------- corepkgs/nar.nix | 30 +++++++++++++++++++ corepkgs/nar/Makefile.am | 11 ------- corepkgs/nar/nar.nix | 7 ----- corepkgs/nar/nar.sh.in | 12 -------- scripts/nix-push.in | 5 +--- src/nix-env/user-env.cc | 2 +- tests/common.sh.in | 7 +---- tests/init.sh | 24 --------------- tests/lang.sh | 2 +- tests/lang/eval-okay-search-path.nix | 2 +- tests/user-envs.sh | 2 +- 15 files changed, 52 insertions(+), 84 deletions(-) rename corepkgs/{buildenv/default.nix => buildenv.nix} (81%) rename corepkgs/{buildenv/builder.pl.in => buildenv.pl} (99%) mode change 100755 => 100644 delete mode 100644 corepkgs/buildenv/Makefile.am create mode 100644 corepkgs/nar.nix delete mode 100644 corepkgs/nar/Makefile.am delete mode 100644 corepkgs/nar/nar.nix delete mode 100644 corepkgs/nar/nar.sh.in diff --git a/corepkgs/Makefile.am b/corepkgs/Makefile.am index b303a30eb..7f43a700e 100644 --- a/corepkgs/Makefile.am +++ b/corepkgs/Makefile.am @@ -1 +1,11 @@ -SUBDIRS = nar buildenv channels +SUBDIRS = channels + +all-local: config.nix + +install-exec-local: + $(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs + $(INSTALL_DATA) config.nix $(srcdir)/nar.nix $(srcdir)/buildenv.nix $(srcdir)/buildenv.pl $(DESTDIR)$(datadir)/nix/corepkgs + +include ../substitute.mk + +EXTRA_DIST = config.nix.in nar.nix buildenv.nix buildenv.pl diff --git a/corepkgs/buildenv/default.nix b/corepkgs/buildenv.nix similarity index 81% rename from corepkgs/buildenv/default.nix rename to corepkgs/buildenv.nix index d76f52740..6e2bee10b 100644 --- a/corepkgs/buildenv/default.nix +++ b/corepkgs/buildenv.nix @@ -1,9 +1,12 @@ -{system, derivations, manifest}: +with import ; + +{ system, derivations, manifest }: derivation { name = "user-environment"; system = system; - builder = ./builder.pl; + builder = perl; + args = [ "-w" ./buildenv.pl ]; manifest = manifest; diff --git a/corepkgs/buildenv/builder.pl.in b/corepkgs/buildenv.pl old mode 100755 new mode 100644 similarity index 99% rename from corepkgs/buildenv/builder.pl.in rename to corepkgs/buildenv.pl index 86abe0ca1..52a703c06 --- a/corepkgs/buildenv/builder.pl.in +++ b/corepkgs/buildenv.pl @@ -1,5 +1,3 @@ -#! @perl@ -w - use strict; use Cwd; use IO::Handle; diff --git a/corepkgs/buildenv/Makefile.am b/corepkgs/buildenv/Makefile.am deleted file mode 100644 index eeab538ab..000000000 --- a/corepkgs/buildenv/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -all-local: builder.pl - -install-exec-local: - $(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs - $(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs/buildenv - $(INSTALL_DATA) $(srcdir)/default.nix $(DESTDIR)$(datadir)/nix/corepkgs/buildenv - $(INSTALL_PROGRAM) builder.pl $(DESTDIR)$(datadir)/nix/corepkgs/buildenv - -include ../../substitute.mk - -EXTRA_DIST = default.nix builder.pl.in diff --git a/corepkgs/nar.nix b/corepkgs/nar.nix new file mode 100644 index 000000000..70a4af2f9 --- /dev/null +++ b/corepkgs/nar.nix @@ -0,0 +1,30 @@ +with import ; + +let + + builder = builtins.toFile "nar.sh" + '' + export PATH=${nixBinDir}:${coreutils} + + echo "packing ‘$storePath’..." + mkdir $out + dst=$out/tmp.nar.bz2 + + set -o pipefail + nix-store --dump "$storePath" | ${bzip2} > $dst + + nix-hash --flat --type $hashAlgo --base32 $dst > $out/narbz2-hash + + mv $out/tmp.nar.bz2 $out/$(cat $out/narbz2-hash).nar.bz2 + ''; + +in + +{ system, storePath, hashAlgo }: + +derivation { + name = "nar"; + builder = shell; + args = [ "-e" builder ]; + inherit system storePath hashAlgo; +} diff --git a/corepkgs/nar/Makefile.am b/corepkgs/nar/Makefile.am deleted file mode 100644 index 103051e22..000000000 --- a/corepkgs/nar/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -all-local: nar.sh - -install-exec-local: - $(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs - $(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs/nar - $(INSTALL_DATA) $(srcdir)/nar.nix $(DESTDIR)$(datadir)/nix/corepkgs/nar - $(INSTALL_PROGRAM) nar.sh $(DESTDIR)$(datadir)/nix/corepkgs/nar - -include ../../substitute.mk - -EXTRA_DIST = nar.nix nar.sh.in diff --git a/corepkgs/nar/nar.nix b/corepkgs/nar/nar.nix deleted file mode 100644 index d3d799998..000000000 --- a/corepkgs/nar/nar.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ system, storePath, hashAlgo }: - -derivation { - name = "nar"; - builder = ./nar.sh; - inherit system storePath hashAlgo; -} diff --git a/corepkgs/nar/nar.sh.in b/corepkgs/nar/nar.sh.in deleted file mode 100644 index 1369d3a21..000000000 --- a/corepkgs/nar/nar.sh.in +++ /dev/null @@ -1,12 +0,0 @@ -#! @shell@ -e - -echo "packing $storePath into $out..." -@coreutils@/mkdir $out -dst=$out/tmp.nar.bz2 -@bindir@/nix-store --dump "$storePath" > tmp - -@bzip2@ < tmp > $dst - -@bindir@/nix-hash --flat --type $hashAlgo --base32 $dst > $out/narbz2-hash - -@coreutils@/mv $out/tmp.nar.bz2 $out/$(@coreutils@/cat $out/narbz2-hash).nar.bz2 diff --git a/scripts/nix-push.in b/scripts/nix-push.in index cf46d00df..cb7a478ba 100755 --- a/scripts/nix-push.in +++ b/scripts/nix-push.in @@ -20,9 +20,6 @@ $curl = "$curl $extraCurlFlags" if defined $extraCurlFlags; my $binDir = $ENV{"NIX_BIN_DIR"} || "@bindir@"; -my $dataDir = $ENV{"NIX_DATA_DIR"}; -$dataDir = "@datadir@" unless defined $dataDir; - # Parse the command line. my $localCopy; @@ -107,7 +104,7 @@ foreach my $storePath (@storePaths) { # Construct a Nix expression that creates a Nix archive. my $nixexpr = - "((import $dataDir/nix/corepkgs/nar/nar.nix) " . + "(import " . "{ storePath = builtins.storePath \"$storePath\"; system = \"@system@\"; hashAlgo = \"$hashAlgo\"; }) "; print NIX $nixexpr; diff --git a/src/nix-env/user-env.cc b/src/nix-env/user-env.cc index 670052bcb..0dcdcc0d1 100644 --- a/src/nix-env/user-env.cc +++ b/src/nix-env/user-env.cc @@ -112,7 +112,7 @@ bool createUserEnv(EvalState & state, DrvInfos & elems, /* Get the environment builder expression. */ Value envBuilder; - state.evalFile(nixDataDir + "/nix/corepkgs/buildenv", envBuilder); + state.evalFile(state.findFile("nix/buildenv.nix"), envBuilder); /* Construct a Nix expression that calls the user environment builder with the manifest as argument. */ diff --git a/tests/common.sh.in b/tests/common.sh.in index 4ab490a62..7504dc059 100644 --- a/tests/common.sh.in +++ b/tests/common.sh.in @@ -9,7 +9,6 @@ if ! NIX_STORE_DIR=$(readlink -f $TEST_ROOT/store 2> /dev/null); then export NIX_IGNORE_SYMLINK_STORE=1 NIX_STORE_DIR=$TEST_ROOT/store fi -export NIX_DATA_DIR=$TEST_ROOT/data export NIX_LOCALSTATE_DIR=$TEST_ROOT/var export NIX_LOG_DIR=$TEST_ROOT/var/log/nix export NIX_STATE_DIR=$TEST_ROOT/var/nix @@ -19,15 +18,11 @@ export NIX_BIN_DIR=$TEST_ROOT/bin export NIX_LIBEXEC_DIR=$TEST_ROOT/bin export NIX_MANIFESTS_DIR=$TEST_ROOT/var/nix/manifests export NIX_ROOT_FINDER= +export NIX_PATH=nix=$TOP/corepkgs export SHARED=$TEST_ROOT/shared export PATH=$NIX_BIN_DIR:$TOP/scripts:$PATH -export REAL_BIN_DIR=@bindir@ -export REAL_LIBEXEC_DIR=@libexecdir@ -export REAL_LOCALSTATE_DIR=@localstatedir@ -export REAL_DATA_DIR=@datadir@ -export REAL_STORE_DIR=@storedir@ export NIX_BUILD_HOOK= export PERL=perl export PERL5LIB=$TOP/perl/lib:$PERL5LIB diff --git a/tests/init.sh b/tests/init.sh index 63e939dff..9ce7985d7 100644 --- a/tests/init.sh +++ b/tests/init.sh @@ -10,7 +10,6 @@ fi mkdir "$TEST_ROOT" mkdir "$NIX_STORE_DIR" -mkdir "$NIX_DATA_DIR" mkdir "$NIX_LOCALSTATE_DIR" mkdir -p "$NIX_LOG_DIR"/drvs mkdir "$NIX_STATE_DIR" @@ -39,29 +38,6 @@ env-keep-derivations = false fsync-metadata = false EOF -mkdir $NIX_DATA_DIR/nix -cp -pr $TOP/corepkgs $NIX_DATA_DIR/nix/ -# Bah, scripts have the prefix hard-coded. This is really messy stuff -# (and likely to fail). -for i in \ - $NIX_DATA_DIR/nix/corepkgs/nar/nar.sh \ - ; do - sed < $i > $i.tmp \ - -e "s^$REAL_BIN_DIR/nix-store^$NIX_BIN_DIR/nix-store^" \ - -e "s^$REAL_BIN_DIR/nix-hash^$NIX_BIN_DIR/nix-hash^" \ - -e "s^$REAL_LIBEXEC_DIR^$NIX_LIBEXEC_DIR^" \ - -e "s^$REAL_LOCALSTATE_DIR^$NIX_LOCALSTATE_DIR^" \ - -e "s^$REAL_DATA_DIR^$NIX_DATA_DIR^" \ - -e "s^$REAL_STORE_DIR\([^/]\)^$NIX_STORE_DIR\1^" - mv $i.tmp $i - chmod +x $i -done - -# Another ugly hack. -sed "s|^$|PATH='$PATH'|" < $NIX_DATA_DIR/nix/corepkgs/nar/nar.sh > tmp -chmod +x tmp -mv tmp $NIX_DATA_DIR/nix/corepkgs/nar/nar.sh - # An uberhack for Mac OS X 10.5: download-using-manifests uses Perl, # and Perl links against Darwin's libutil.dylib (in /usr/lib), but # when running "make check", the libtool wrapper script around the Nix diff --git a/tests/lang.sh b/tests/lang.sh index c9fc65e6a..cab1cfd9b 100644 --- a/tests/lang.sh +++ b/tests/lang.sh @@ -40,7 +40,7 @@ for i in lang/eval-okay-*.nix; do if test -e lang/$i.flags; then flags=$(cat lang/$i.flags) fi - if ! NIX_PATH=lang/dir3:lang/dir4 nix-instantiate $flags --eval-only --strict lang/$i.nix > lang/$i.out; then + if ! NIX_PATH=lang/dir3:lang/dir4:$NIX_PATH nix-instantiate $flags --eval-only --strict lang/$i.nix > lang/$i.out; then echo "FAIL: $i should evaluate" fail=1 elif ! diff lang/$i.out lang/$i.exp; then diff --git a/tests/lang/eval-okay-search-path.nix b/tests/lang/eval-okay-search-path.nix index 21485dbbf..9b7115023 100644 --- a/tests/lang/eval-okay-search-path.nix +++ b/tests/lang/eval-okay-search-path.nix @@ -1,3 +1,3 @@ -assert builtins.pathExists ; +assert builtins.pathExists ; import + import + import + import diff --git a/tests/user-envs.sh b/tests/user-envs.sh index 5037e28b9..2bc9bee50 100644 --- a/tests/user-envs.sh +++ b/tests/user-envs.sh @@ -36,7 +36,7 @@ nix-env -p $profiles/test -q '*' | grep -q foo-2.0pre1 test "$($profiles/test/bin/foo)" = "foo-2.0pre1" # Upgrade "foo": should install foo-2.0. -NIX_PATH=nixpkgs=./user-envs.nix nix-env -p $profiles/test -f '' -u foo +NIX_PATH=nixpkgs=./user-envs.nix:$NIX_PATH nix-env -p $profiles/test -f '' -u foo # Query installed: should contain foo-2.0 now. test "$(nix-env -p $profiles/test -q '*' | wc -l)" -eq 1 From dadbb51d969517c1f2512015ab201dc99088d9a6 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 3 Jan 2012 00:47:27 +0000 Subject: [PATCH 5/8] * Use Nix::Config. --- scripts/nix-build.in | 7 +++---- scripts/nix-collect-garbage.in | 7 +++---- scripts/nix-pull.in | 5 +---- scripts/nix-push.in | 18 ++++++++---------- 4 files changed, 15 insertions(+), 22 deletions(-) diff --git a/scripts/nix-build.in b/scripts/nix-build.in index d9d1da73b..68c24b75d 100755 --- a/scripts/nix-build.in +++ b/scripts/nix-build.in @@ -1,8 +1,7 @@ #! @perl@ -w -I@libexecdir@/nix use strict; - -my $binDir = $ENV{"NIX_BIN_DIR"} || "@bindir@"; +use Nix::Config; my $addDrvLink = 0; @@ -156,7 +155,7 @@ foreach my $expr (@exprs) { # Instantiate. my @drvPaths; # !!! would prefer the perl 5.8.0 pipe open feature here. - my $pid = open(DRVPATHS, "-|") || exec "$binDir/nix-instantiate", "--add-root", $drvLink, "--indirect", @instArgs, $expr; + my $pid = open(DRVPATHS, "-|") || exec "$Nix::Config::binDir/nix-instantiate", "--add-root", $drvLink, "--indirect", @instArgs, $expr; while () {chomp; push @drvPaths, $_;} if (!close DRVPATHS) { die "nix-instantiate killed by signal " . ($? & 127) . "\n" if ($? & 127); @@ -170,7 +169,7 @@ foreach my $expr (@exprs) { # Build. my @outPaths; - $pid = open(OUTPATHS, "-|") || exec "$binDir/nix-store", "--add-root", $outLink, "--indirect", "-r", + $pid = open(OUTPATHS, "-|") || exec "$Nix::Config::binDir/nix-store", "--add-root", $outLink, "--indirect", "-r", @buildArgs, @drvPaths; while () {chomp; push @outPaths, $_;} if (!close OUTPATHS) { diff --git a/scripts/nix-collect-garbage.in b/scripts/nix-collect-garbage.in index f445c1c71..00e61a24b 100755 --- a/scripts/nix-collect-garbage.in +++ b/scripts/nix-collect-garbage.in @@ -1,11 +1,10 @@ #! @perl@ -w use strict; +use Nix::Config; my $profilesDir = "@localstatedir@/nix/profiles"; -my $binDir = $ENV{"NIX_BIN_DIR"} || "@bindir@"; - # Process the command line arguments. my @args = (); @@ -36,7 +35,7 @@ sub removeOldGenerations { $name = $dir . "/" . $name; if (-l $name && (readlink($name) =~ /link/)) { print STDERR "removing old generations of profile $name\n"; - system("$binDir/nix-env", "-p", $name, "--delete-generations", "old"); + system("$Nix::Config::binDir/nix-env", "-p", $name, "--delete-generations", "old"); } elsif (! -l $name && -d $name) { removeOldGenerations $name; @@ -50,4 +49,4 @@ removeOldGenerations $profilesDir if $removeOld; # Run the actual garbage collector. -exec "$binDir/nix-store", "--gc", @args; +exec "$Nix::Config::binDir/nix-store", "--gc", @args; diff --git a/scripts/nix-pull.in b/scripts/nix-pull.in index 74545a350..136a5c9fa 100755 --- a/scripts/nix-pull.in +++ b/scripts/nix-pull.in @@ -8,9 +8,6 @@ use Nix::Manifest; my $tmpDir = tempdir("nix-pull.XXXXXX", CLEANUP => 1, TMPDIR => 1) or die "cannot create a temporary directory"; -my $libexecDir = ($ENV{"NIX_LIBEXEC_DIR"} or "@libexecdir@"); -my $storeDir = ($ENV{"NIX_STORE_DIR"} or "@storedir@"); -my $stateDir = ($ENV{"NIX_STATE_DIR"} or "@localstatedir@/nix"); my $manifestDir = $Nix::Config::manifestDir; @@ -25,7 +22,7 @@ if (! -e $manifestDir) { # Make sure that the manifests directory is scanned for GC roots. -my $gcRootsDir = "$stateDir/gcroots"; +my $gcRootsDir = "$Nix::Config::stateDir/gcroots"; my $manifestDirLink = "$gcRootsDir/manifests"; if (! -l $manifestDirLink) { symlink($manifestDir, $manifestDirLink) or die "cannot create symlink `$manifestDirLink'"; diff --git a/scripts/nix-push.in b/scripts/nix-push.in index cb7a478ba..1e0918abd 100755 --- a/scripts/nix-push.in +++ b/scripts/nix-push.in @@ -18,8 +18,6 @@ my $curl = "$Nix::Config::curl --fail --silent"; my $extraCurlFlags = ${ENV{'CURL_FLAGS'}}; $curl = "$curl $extraCurlFlags" if defined $extraCurlFlags; -my $binDir = $ENV{"NIX_BIN_DIR"} || "@bindir@"; - # Parse the command line. my $localCopy; @@ -79,7 +77,7 @@ foreach my $path (@ARGV) { # Get all paths referenced by the normalisation of the given # Nix expression. my $pid = open(READ, - "$binDir/nix-store --query --requisites --force-realise " . + "$Nix::Config::binDir/nix-store --query --requisites --force-realise " . "--include-outputs '$path'|") or die; while () { @@ -117,7 +115,7 @@ close NIX; # Instantiate store derivations from the Nix expression. my @storeExprs; print STDERR "instantiating store derivations...\n"; -my $pid = open(READ, "$binDir/nix-instantiate $nixExpr|") +my $pid = open(READ, "$Nix::Config::binDir/nix-instantiate $nixExpr|") or die "cannot run nix-instantiate"; while () { chomp; @@ -139,7 +137,7 @@ while (scalar @tmp > 0) { my @tmp2 = @tmp[0..$n - 1]; @tmp = @tmp[$n..scalar @tmp - 1]; - my $pid = open(READ, "$binDir/nix-store --realise @tmp2|") + my $pid = open(READ, "$Nix::Config::binDir/nix-store --realise @tmp2|") or die "cannot run nix-store"; while () { chomp; @@ -179,16 +177,16 @@ for (my $n = 0; $n < scalar @storePaths; $n++) { my $narbz2Size = stat($narFile)->size; - my $references = `$binDir/nix-store --query --references '$storePath'`; + my $references = `$Nix::Config::binDir/nix-store --query --references '$storePath'`; die "cannot query references for `$storePath'" if $? != 0; $references = join(" ", split(" ", $references)); - my $deriver = `$binDir/nix-store --query --deriver '$storePath'`; + my $deriver = `$Nix::Config::binDir/nix-store --query --deriver '$storePath'`; die "cannot query deriver for `$storePath'" if $? != 0; chomp $deriver; $deriver = "" if $deriver eq "unknown-deriver"; - my $narHash = `$binDir/nix-store --query --hash '$storePath'`; + my $narHash = `$Nix::Config::binDir/nix-store --query --hash '$storePath'`; die "cannot query hash for `$storePath'" if $? != 0; chomp $narHash; @@ -196,13 +194,13 @@ for (my $n = 0; $n < scalar @storePaths; $n++) { # store of the host), the database doesn't contain the hash. So # compute it. if ($narHash =~ /^sha256:0*$/) { - $narHash = `$binDir/nix-hash --type sha256 --base32 '$storePath'`; + $narHash = `$Nix::Config::binDir/nix-hash --type sha256 --base32 '$storePath'`; die "cannot hash `$storePath'" if $? != 0; chomp $narHash; $narHash = "sha256:$narHash"; } - my $narSize = `$binDir/nix-store --query --size '$storePath'`; + my $narSize = `$Nix::Config::binDir/nix-store --query --size '$storePath'`; die "cannot query size for `$storePath'" if $? != 0; chomp $narSize; From 39d45a6b090b5105423b22b8ef39c2a4a000a4a1 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 3 Jan 2012 01:51:38 +0000 Subject: [PATCH 6/8] * Add a test for nix-channel. * Refactor the nix-channel unpacker a bit. --- configure.ac | 3 --- corepkgs/Makefile.am | 8 +++---- corepkgs/channels/Makefile.am | 11 --------- corepkgs/channels/unpack.nix | 7 ------ corepkgs/channels/unpack.sh.in | 35 --------------------------- corepkgs/unpack-channel.nix | 11 +++++++++ corepkgs/unpack-channel.sh | 30 ++++++++++++++++++++++++ perl/lib/Nix/Config.pm.in | 1 + scripts/nix-channel.in | 22 ++++++++--------- tests/Makefile.am | 3 +-- tests/config.nix.in | 3 ++- tests/dependencies.nix | 1 + tests/nix-channel.sh | 43 ++++++++++++++++++++++++++++++++++ 13 files changed, 103 insertions(+), 75 deletions(-) delete mode 100644 corepkgs/channels/Makefile.am delete mode 100644 corepkgs/channels/unpack.nix delete mode 100644 corepkgs/channels/unpack.sh.in create mode 100644 corepkgs/unpack-channel.nix create mode 100644 corepkgs/unpack-channel.sh create mode 100644 tests/nix-channel.sh diff --git a/configure.ac b/configure.ac index 0443fe492..52c92b76b 100644 --- a/configure.ac +++ b/configure.ac @@ -346,9 +346,6 @@ AC_CONFIG_FILES([Makefile perl/Makefile scripts/Makefile corepkgs/Makefile - corepkgs/nar/Makefile - corepkgs/buildenv/Makefile - corepkgs/channels/Makefile doc/Makefile doc/manual/Makefile misc/Makefile diff --git a/corepkgs/Makefile.am b/corepkgs/Makefile.am index 7f43a700e..86d7027ed 100644 --- a/corepkgs/Makefile.am +++ b/corepkgs/Makefile.am @@ -1,11 +1,11 @@ -SUBDIRS = channels - all-local: config.nix +files = nar.nix buildenv.nix buildenv.pl unpack-channel.nix unpack-channel.sh + install-exec-local: $(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs - $(INSTALL_DATA) config.nix $(srcdir)/nar.nix $(srcdir)/buildenv.nix $(srcdir)/buildenv.pl $(DESTDIR)$(datadir)/nix/corepkgs + $(INSTALL_DATA) config.nix $(files) $(DESTDIR)$(datadir)/nix/corepkgs include ../substitute.mk -EXTRA_DIST = config.nix.in nar.nix buildenv.nix buildenv.pl +EXTRA_DIST = config.nix.in $(files) diff --git a/corepkgs/channels/Makefile.am b/corepkgs/channels/Makefile.am deleted file mode 100644 index d4d478f0e..000000000 --- a/corepkgs/channels/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -all-local: unpack.sh - -install-exec-local: - $(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs - $(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs/channels - $(INSTALL_DATA) $(srcdir)/unpack.nix $(DESTDIR)$(datadir)/nix/corepkgs/channels - $(INSTALL_PROGRAM) unpack.sh $(DESTDIR)$(datadir)/nix/corepkgs/channels - -include ../../substitute.mk - -EXTRA_DIST = unpack.nix unpack.sh.in diff --git a/corepkgs/channels/unpack.nix b/corepkgs/channels/unpack.nix deleted file mode 100644 index 80ca4a371..000000000 --- a/corepkgs/channels/unpack.nix +++ /dev/null @@ -1,7 +0,0 @@ -{system, inputs}: - -derivation { - name = "channels"; - builder = ./unpack.sh; - inherit system inputs; -} \ No newline at end of file diff --git a/corepkgs/channels/unpack.sh.in b/corepkgs/channels/unpack.sh.in deleted file mode 100644 index 6e5939f4f..000000000 --- a/corepkgs/channels/unpack.sh.in +++ /dev/null @@ -1,35 +0,0 @@ -#! @shell@ -e - -# Cygwin compatibility hack: bunzip2 expects cygwin.dll in $PATH. -export PATH=@coreutils@ - -@coreutils@/mkdir $out -@coreutils@/mkdir $out/tmp -cd $out/tmp - -inputs=($inputs) -for ((n = 0; n < ${#inputs[*]}; n += 2)); do - channelName=${inputs[n]} - channelTarball=${inputs[n+1]} - - echo "unpacking channel $channelName" - - @bzip2@ -d < $channelTarball | @tar@ xf - - - if test -e */channel-name; then - channelName="$(@coreutils@/cat */channel-name)" - fi - - nr=1 - attrName=$(echo $channelName | @tr@ -- '- ' '__') - dirName=$attrName - while test -e ../$dirName; do - nr=$((nr+1)) - dirName=$attrName-$nr - done - - @coreutils@/mv * ../$dirName # !!! hacky -done - -cd .. -@coreutils@/rmdir tmp diff --git a/corepkgs/unpack-channel.nix b/corepkgs/unpack-channel.nix new file mode 100644 index 000000000..5e6ccf23f --- /dev/null +++ b/corepkgs/unpack-channel.nix @@ -0,0 +1,11 @@ +with import ; + +{ system, inputs }: + +derivation { + name = "channels"; + builder = shell; + args = [ "-e" ./unpack-channel.sh ]; + inherit system inputs bzip2 tar tr; + PATH = "${nixBinDir}:${coreutils}"; +} diff --git a/corepkgs/unpack-channel.sh b/corepkgs/unpack-channel.sh new file mode 100644 index 000000000..7c244a6a8 --- /dev/null +++ b/corepkgs/unpack-channel.sh @@ -0,0 +1,30 @@ +mkdir $out +mkdir $out/tmp +cd $out/tmp + +inputs=($inputs) +for ((n = 0; n < ${#inputs[*]}; n += 2)); do + channelName=${inputs[n]} + channelTarball=${inputs[n+1]} + + echo "unpacking channel $channelName" + + $bzip2 -d < $channelTarball | $tar xf - + + if test -e */channel-name; then + channelName="$(cat */channel-name)" + fi + + nr=1 + attrName=$(echo $channelName | $tr -- '- ' '__') + dirName=$attrName + while test -e ../$dirName; do + nr=$((nr+1)) + dirName=$attrName-$nr + done + + mv * ../$dirName # !!! hacky +done + +cd .. +rmdir tmp diff --git a/perl/lib/Nix/Config.pm.in b/perl/lib/Nix/Config.pm.in index b657683be..c88854daf 100644 --- a/perl/lib/Nix/Config.pm.in +++ b/perl/lib/Nix/Config.pm.in @@ -2,6 +2,7 @@ package Nix::Config; $binDir = $ENV{"NIX_BIN_DIR"} || "@bindir@"; $libexecDir = $ENV{"NIX_LIBEXEC_DIR"} || "@libexecdir@"; +$stateDir = $ENV{"NIX_STATE_DIR"} || "@localstatedir@/nix"; $manifestDir = $ENV{"NIX_MANIFESTS_DIR"} || "@localstatedir@/nix/manifests"; $logDir = $ENV{"NIX_LOG_DIR"} || "@localstatedir@/log/nix"; $confDir = $ENV{"NIX_CONF_DIR"} || "@sysconfdir@/nix"; diff --git a/scripts/nix-channel.in b/scripts/nix-channel.in index 3688063cb..9bfa04722 100755 --- a/scripts/nix-channel.in +++ b/scripts/nix-channel.in @@ -1,15 +1,13 @@ #! @perl@ -w use strict; +use Nix::Config; -my $rootsDir = "@localstatedir@/nix/gcroots"; - -my $stateDir = $ENV{"NIX_STATE_DIR"}; -$stateDir = "@localstatedir@/nix" unless defined $stateDir; +my $manifestDir = $Nix::Config::manifestDir; # Turn on caching in nix-prefetch-url. -my $channelCache = "$stateDir/channel-cache"; +my $channelCache = "$Nix::Config::stateDir/channel-cache"; mkdir $channelCache, 0755 unless -e $channelCache; $ENV{'NIX_DOWNLOAD_CACHE'} = $channelCache if -W $channelCache; @@ -79,19 +77,19 @@ sub update { readChannels; # Create the manifests directory if it doesn't exist. - mkdir "$stateDir/manifests", 0755 unless -e "$stateDir/manifests"; + mkdir $manifestDir, 0755 unless -e $manifestDir; # Do we have write permission to the manifests directory? If not, # then just skip pulling the manifest and just download the Nix # expressions. If the user is a non-privileged user in a # multi-user Nix installation, he at least gets installation from # source. - if (-W "$stateDir/manifests") { + if (-W $manifestDir) { # Pull cache manifests. foreach my $url (@channels) { #print "pulling cache manifest from `$url'\n"; - system("@bindir@/nix-pull", "--skip-wrong-store", "$url/MANIFEST") == 0 + system("$Nix::Config::binDir/nix-pull", "--skip-wrong-store", "$url/MANIFEST") == 0 or die "cannot pull cache manifest from `$url'"; } @@ -110,7 +108,7 @@ sub update { print "downloading Nix expressions from `$fullURL'...\n"; $ENV{"PRINT_PATH"} = 1; $ENV{"QUIET"} = 1; - my ($hash, $path) = `@bindir@/nix-prefetch-url '$fullURL'`; + my ($hash, $path) = `$Nix::Config::binDir/nix-prefetch-url '$fullURL'`; die "cannot fetch `$fullURL'" if $? != 0; chomp $path; $inputs .= '"' . $channelName . '"' . " " . $path . " "; @@ -121,13 +119,13 @@ sub update { my $userName = getpwuid($<); die "who ARE you? go away" unless defined $userName; - my $rootFile = "$rootsDir/per-user/$userName/channels"; + my $rootFile = "$Nix::Config::stateDir/gcroots/per-user/$userName/channels"; # Build the Nix expression. print "unpacking channel Nix expressions...\n"; my $outPath = `\\ - @bindir@/nix-build --out-link '$rootFile' --drv-link '$rootFile'.tmp \\ - @datadir@/nix/corepkgs/channels/unpack.nix \\ + $Nix::Config::binDir/nix-build --out-link '$rootFile' --drv-link '$rootFile'.tmp \\ + '' \\ --argstr system @system@ --arg inputs '$inputs'` or die "cannot unpack the channels"; chomp $outPath; diff --git a/tests/Makefile.am b/tests/Makefile.am index 38bfa139d..dbafd553a 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -8,7 +8,7 @@ TESTS = init.sh hash.sh lang.sh add.sh simple.sh dependencies.sh \ referrers.sh user-envs.sh logging.sh nix-build.sh misc.sh fixed.sh \ gc-runtime.sh install-package.sh check-refs.sh filter-source.sh \ remote-store.sh export.sh export-graph.sh negative-caching.sh \ - binary-patching.sh timeout.sh secure-drv-outputs.sh + binary-patching.sh timeout.sh secure-drv-outputs.sh nix-channel.sh XFAIL_TESTS = @@ -37,4 +37,3 @@ EXTRA_DIST = $(TESTS) \ secure-drv-outputs.nix \ $(wildcard lang/*.nix) $(wildcard lang/*.exp) $(wildcard lang/*.exp.xml) $(wildcard lang/*.flags) $(wildcard lang/dir*/*.nix) \ common.sh.in - diff --git a/tests/config.nix.in b/tests/config.nix.in index 2bfee8b44..db3da1451 100644 --- a/tests/config.nix.in +++ b/tests/config.nix.in @@ -13,5 +13,6 @@ rec { builder = shell; args = ["-e" args.builder]; PATH = path; - } // removeAttrs args ["builder"]); + } // removeAttrs args ["builder" "meta"]) + // { meta = args.meta or {}; }; } diff --git a/tests/dependencies.nix b/tests/dependencies.nix index 00717ae98..6f6a7e46f 100644 --- a/tests/dependencies.nix +++ b/tests/dependencies.nix @@ -17,6 +17,7 @@ let { builder = ./dependencies.builder0.sh + "/FOOBAR/../."; input1 = input1 + "/."; inherit input2; + meta.description = "Random test package"; }; } diff --git a/tests/nix-channel.sh b/tests/nix-channel.sh new file mode 100644 index 000000000..1d7724e93 --- /dev/null +++ b/tests/nix-channel.sh @@ -0,0 +1,43 @@ +source common.sh + +clearProfiles +clearManifests + +rm -f $TEST_ROOT/.nix-channels + +# Override location of ~/.nix-channels. +export HOME=$TEST_ROOT + +# Test add/list/remove. +nix-channel --add http://foo/bar +nix-channel --list | grep -q http://foo/bar +nix-channel --remove http://foo/bar + +[ -e $TEST_ROOT/.nix-channels ] +[ "$(cat $TEST_ROOT/.nix-channels)" = '' ] + +# Create a channel. +rm -rf $TEST_ROOT/foo +mkdir -p $TEST_ROOT/foo +nix-push --copy $TEST_ROOT/foo $TEST_ROOT/foo/MANIFEST $(nix-store -r $(nix-instantiate dependencies.nix)) +rm -rf $TEST_ROOT/nixexprs +mkdir -p $TEST_ROOT/nixexprs +cp config.nix dependencies.nix dependencies.builder*.sh $TEST_ROOT/nixexprs/ +ln -s dependencies.nix $TEST_ROOT/nixexprs/default.nix +(cd $TEST_ROOT && tar cv nixexprs) | bzip2 > $TEST_ROOT/foo/nixexprs.tar.bz2 + +# Test the update action. +nix-channel --add file://$TEST_ROOT/foo +nix-channel --update + +# Do a query. +nix-env -qa \* --meta --xml --out-path > $TEST_ROOT/meta.xml +if [ "$xmllint" != false ]; then + $xmllint --noout $TEST_ROOT/meta.xml || fail "malformed XML" +fi +grep -q 'meta.*description.*Random test package' $TEST_ROOT/meta.xml +grep -q 'item.*attrPath="foo".*name="dependencies"' $TEST_ROOT/meta.xml + +# Do an install. +nix-env -i dependencies +[ -e $TEST_ROOT/var/nix/profiles/default/foobar ] From 9b7df1ef007d9209b17f7aa40a03be0250ea30d0 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 3 Jan 2012 09:19:40 +0000 Subject: [PATCH 7/8] * Forgot to add. --- corepkgs/config.nix.in | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 corepkgs/config.nix.in diff --git a/corepkgs/config.nix.in b/corepkgs/config.nix.in new file mode 100644 index 000000000..b324d732a --- /dev/null +++ b/corepkgs/config.nix.in @@ -0,0 +1,13 @@ +let + fromEnv = var: def: + let val = builtins.getEnv var; in + if val != "" then val else def; +in { + perl = "@perl@"; + shell = "@shell@"; + coreutils = "@coreutils@"; + bzip2 = fromEnv "NIX_BZIP2" "@bzip2@"; + tar = "@tar@"; + tr = "@tr@"; + nixBinDir = fromEnv "NIX_BIN_DIR" "@bindir@"; +} From 63227d434cefaa9faeb14afe28ebeb9b2d449ee2 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 3 Jan 2012 12:18:41 +0000 Subject: [PATCH 8/8] * FreeBSD tar defaults to the tape device instead of stdout. --- tests/nix-channel.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/nix-channel.sh b/tests/nix-channel.sh index 1d7724e93..4819b57c9 100644 --- a/tests/nix-channel.sh +++ b/tests/nix-channel.sh @@ -24,7 +24,7 @@ rm -rf $TEST_ROOT/nixexprs mkdir -p $TEST_ROOT/nixexprs cp config.nix dependencies.nix dependencies.builder*.sh $TEST_ROOT/nixexprs/ ln -s dependencies.nix $TEST_ROOT/nixexprs/default.nix -(cd $TEST_ROOT && tar cv nixexprs) | bzip2 > $TEST_ROOT/foo/nixexprs.tar.bz2 +(cd $TEST_ROOT && tar cvf - nixexprs) | bzip2 > $TEST_ROOT/foo/nixexprs.tar.bz2 # Test the update action. nix-channel --add file://$TEST_ROOT/foo