summary refs log tree commit diff
path: root/pkgs/build-support/rust/build-rust-crate/log.nix
diff options
context:
space:
mode:
authorAndreas Rammhold <andreas@rammhold.de>2020-01-02 13:42:33 +0100
committerGitHub <noreply@github.com>2020-01-02 13:42:33 +0100
commit9f03cb8562645cb1cd515b8553d1dc94c3402a2e (patch)
tree86d7d1dbf4535114b6ca6603166842fb40d1a8d1 /pkgs/build-support/rust/build-rust-crate/log.nix
parent2ff742e970dedce68fb8a2c1374ea1aaa3f8e686 (diff)
parent2eaaf7aafd861c4e92b1ae89b7edbfb383d28a4a (diff)
downloadnixpkgs-9f03cb8562645cb1cd515b8553d1dc94c3402a2e.tar
nixpkgs-9f03cb8562645cb1cd515b8553d1dc94c3402a2e.tar.gz
nixpkgs-9f03cb8562645cb1cd515b8553d1dc94c3402a2e.tar.bz2
nixpkgs-9f03cb8562645cb1cd515b8553d1dc94c3402a2e.tar.lz
nixpkgs-9f03cb8562645cb1cd515b8553d1dc94c3402a2e.tar.xz
nixpkgs-9f03cb8562645cb1cd515b8553d1dc94c3402a2e.tar.zst
nixpkgs-9f03cb8562645cb1cd515b8553d1dc94c3402a2e.zip
Merge pull request #75563 from andir/cleanup-buildRustCrate
Cleanup buildRustCrate expression
Diffstat (limited to 'pkgs/build-support/rust/build-rust-crate/log.nix')
-rw-r--r--pkgs/build-support/rust/build-rust-crate/log.nix33
1 files changed, 33 insertions, 0 deletions
diff --git a/pkgs/build-support/rust/build-rust-crate/log.nix b/pkgs/build-support/rust/build-rust-crate/log.nix
new file mode 100644
index 00000000000..25181c787e2
--- /dev/null
+++ b/pkgs/build-support/rust/build-rust-crate/log.nix
@@ -0,0 +1,33 @@
+{ lib }:
+{
+  echo_build_heading = colors: ''
+    echo_build_heading() {
+     start=""
+     end=""
+     ${lib.optionalString (colors == "always") ''
+       start="$(printf '\033[0;1;32m')" #set bold, and set green.
+       end="$(printf '\033[0m')" #returns to "normal"
+     ''}
+     if (( $# == 1 )); then
+       echo "$start""Building $1""$end"
+     else
+       echo "$start""Building $1 ($2)""$end"
+     fi
+    }
+  '';
+  noisily = colors: verbose: ''
+    noisily() {
+      start=""
+      end=""
+      ${lib.optionalString (colors == "always") ''
+        start="$(printf '\033[0;1;32m')" #set bold, and set green.
+        end="$(printf '\033[0m')" #returns to "normal"
+      ''}
+  	  ${lib.optionalString verbose ''
+        echo -n "$start"Running "$end"
+        echo $@
+  	  ''}
+  	  $@
+    }
+  '';
+}