1: # Copy the contents of a bunch of directories into one 2: { runCommand }: 3: 4: with builtins; 5: dirs: 6: runCommand "merged-dirs" { dirs = map toString dirs; } '' 7: shopt -s nullglob 8: mkdir -p "$out" 9: 10: for D in $dirs 11: do 12: for F in "$D"/* 13: do 14: cp -as "$F" "$out"/ 15: done 16: chmod +w -R "$out" 17: done 18: ''