from a source directory. All files for which a predicate function
returns true are copied to the store. Typical example is to leave
out the .svn directory:
stdenv.mkDerivation {
...
src = builtins.filterSource
(path: baseNameOf (toString path) != ".svn")
./source-dir;
# as opposed to
# src = ./source-dir;
}
This is important because the .svn directory influences the hash in
a rather unpredictable and variable way.
13 lines
317 B
Bash
13 lines
317 B
Bash
source common.sh
|
|
|
|
rm -rf $TEST_ROOT/filterin
|
|
mkdir $TEST_ROOT/filterin
|
|
mkdir $TEST_ROOT/filterin/foo
|
|
touch $TEST_ROOT/filterin/foo/bar
|
|
touch $TEST_ROOT/filterin/xyzzy
|
|
|
|
$NIX_BIN_DIR/nix-build ./filter-source.nix -o $TEST_ROOT/filterout
|
|
|
|
set -x
|
|
test ! -e $TEST_ROOT/filterout/foo/bar
|
|
test -e $TEST_ROOT/filterout/xyzzy
|