···43 noisily cd "${workspace_member}"
44''}
45 ${lib.optionalString (workspace_member == null) ''
46- echo_colored "Searching for matching Cargo.toml (${crateName})"
47 local cargo_toml_dir=$(matching_cargo_toml_dir "${crateName}")
48 if [ -z "$cargo_toml_dir" ]; then
49 echo_error "ERROR configuring ${crateName}: No matching Cargo.toml in $(pwd) found." >&2
···53''}
5455 runHook preConfigure
56-57 symlink_dependency() {
58 # $1 is the nix-store path of a dependency
59 # $2 is the target path
···43 noisily cd "${workspace_member}"
44''}
45 ${lib.optionalString (workspace_member == null) ''
46+ echo_colored "Searching for matching Cargo.toml (${crateName})"
47 local cargo_toml_dir=$(matching_cargo_toml_dir "${crateName}")
48 if [ -z "$cargo_toml_dir" ]; then
49 echo_error "ERROR configuring ${crateName}: No matching Cargo.toml in $(pwd) found." >&2
···53''}
5455 runHook preConfigure
56+57 symlink_dependency() {
58 # $1 is the nix-store path of a dependency
59 # $2 is the target path
···1{ lib }:
23let echo_colored_body = start_escape:
4- # Body of a function that behaves like "echo" but
5 # has the output colored by the given start_escape
6 # sequence. E.g.
7 #
8 # * echo_x "Building ..."
9 # * echo_x -n "Running "
10 #
11- # This is more complicated than apparent at first sight
12 # because:
13 # * The color markers and the text must be print
14 # in the same echo statement. Otherise, other
15- # intermingled text from concurrent builds will
16 # be colored as well.
17 # * We need to preserve the trailing newline of the
18 # echo if and only if it is present. Bash likes
19 # to strip those if we capture the output of echo
20- # in a variable.
21 # * Leading "-" will be interpreted by test as an
22 # option for itself. Therefore, we prefix it with
23 # an x in `[[ "x$1" =~ ^x- ]]`.
···27 echo_args+=" $1"
28 shift
29 done
30-31 local start_escape="$(printf '${start_escape}')"
32 local reset="$(printf '\033[0m')"
33 echo $echo_args $start_escape"$@"$reset
34 '';
35 echo_conditional_colored_body = colors: start_escape:
36- if colors == "always"
37 then (echo_colored_body start_escape)
38 else ''echo "$@"'';
39in {
···50 noisily = colors: verbose: ''
51 noisily() {
52 ${lib.optionalString verbose ''
53- echo_colored -n "Running "
54 echo $@
55 ''}
56 $@
···1{ lib }:
23let echo_colored_body = start_escape:
4+ # Body of a function that behaves like "echo" but
5 # has the output colored by the given start_escape
6 # sequence. E.g.
7 #
8 # * echo_x "Building ..."
9 # * echo_x -n "Running "
10 #
11+ # This is more complicated than apparent at first sight
12 # because:
13 # * The color markers and the text must be print
14 # in the same echo statement. Otherise, other
15+ # intermingled text from concurrent builds will
16 # be colored as well.
17 # * We need to preserve the trailing newline of the
18 # echo if and only if it is present. Bash likes
19 # to strip those if we capture the output of echo
20+ # in a variable.
21 # * Leading "-" will be interpreted by test as an
22 # option for itself. Therefore, we prefix it with
23 # an x in `[[ "x$1" =~ ^x- ]]`.
···27 echo_args+=" $1"
28 shift
29 done
30+31 local start_escape="$(printf '${start_escape}')"
32 local reset="$(printf '\033[0m')"
33 echo $echo_args $start_escape"$@"$reset
34 '';
35 echo_conditional_colored_body = colors: start_escape:
36+ if colors == "always"
37 then (echo_colored_body start_escape)
38 else ''echo "$@"'';
39in {
···50 noisily = colors: verbose: ''
51 noisily() {
52 ${lib.optionalString verbose ''
53+ echo_colored -n "Running "
54 echo $@
55 ''}
56 $@