nix-helpers: 3c1a789537c6194e2477e615868f1252a73a2430
1: # Create a directory containing 'files'; the directory structure will be
2: # relative to 'base', for example:
3: #
4: # dirContaining /foo/bar [ /foo/bar/baz /foo/bar/quux/foobar ]
5: #
6: # Will produce a directory containing 'baz' and 'quux/foobar'.
7: { mergeDirs, runCommand }:
8:
9: with builtins;
10: base: files:
11: mergeDirs (
12: map (
13: f:
14: runCommand "dir"
15: {
16: base = toString base;
17: file = toString base + "/${f}";
18: }
19: ''
20: REL=$(echo "$file" | sed -e "s@$base/@@g")
21: DIR=$(dirname "$REL")
22: mkdir -p "$out/$DIR"
23: ln -s "$file" "$out/$REL"
24: ''
25: ) files
26: )
Generated by git2html.