diff options
author | makefu <github@syntax-fehler.de> | 2017-08-06 00:05:38 +0200 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2017-08-06 00:05:38 +0200 |
commit | 6d149d2715876319446887959de8fbfa6e8fb0b7 (patch) | |
tree | cc60c19c6a9231b0dca11350917122e8a3f75d51 | |
parent | e515a3a61f14832bf8b4350ed02145898f3ea790 (diff) | |
parent | 7c2d1ba74dbf038ff836aeee5375d598638cdee5 (diff) |
Merge remote-tracking branch 'lass/master'
-rw-r--r-- | krebs/5pkgs/writers.nix | 3 | ||||
-rw-r--r-- | shell.nix | 51 |
2 files changed, 35 insertions, 19 deletions
diff --git a/krebs/5pkgs/writers.nix b/krebs/5pkgs/writers.nix index 850ee6f1a..6e67ed699 100644 --- a/krebs/5pkgs/writers.nix +++ b/krebs/5pkgs/writers.nix @@ -43,9 +43,6 @@ with import <stockholm/lib>; assert (with types; either absolute-pathname filename).check name; pkgs.writeOut (baseNameOf name) { ${optionalString (types.absolute-pathname.check name) name} = { - check = pkgs.writeDash "shellcheck.sh" '' - ${pkgs.haskellPackages.ShellCheck}/bin/shellcheck "$1" || : - ''; executable = true; text = "#! ${pkgs.bash}/bin/bash\n${text}"; }; @@ -8,6 +8,7 @@ let # usage: deploy [--force-populate] [--user=USER] # --system=SYSTEM [--target=TARGET] + # [--verbose] cmds.deploy = pkgs.writeDash "cmds.deploy" '' set -efu @@ -65,6 +66,7 @@ let # usage: test [--force-populate] [--user=USER] # --system=SYSTEM --target=TARGET + # [--verbose] cmds.test = pkgs.writeDash "cmds.test" /* sh */ '' set -efu @@ -145,13 +147,14 @@ let init.args = pkgs.writeText "init.args" /* sh */ '' args=$(${pkgs.utillinux}/bin/getopt -n "$command" -s sh \ -o s:t:u: \ - -l force-populate,system:,target:,user: \ + -l force-populate,system:,target:,user:,verbose \ -- "$@") if \test $? != 0; then exit 1; fi eval set -- "$args" force_populate=false; while :; do case $1 in --force-populate) force_populate=true; shift;; + --verbose) verbose=true; shift;; -s|--system) system=$2; shift 2;; -t|--target) target=$2; shift 2;; -u|--user) user=$2; shift 2;; @@ -194,6 +197,7 @@ let cd "$target_path/stockholm" \; \ NIX_PATH=$(quote "$target_path") \ STOCKHOLM_VERSION=$(quote "$STOCKHOLM_VERSION") \ + verbose=$(quote "$verbose") \ nix-shell --run "$(quote " system=$(quote "$system") \ target=$(quote "$target") \ @@ -206,24 +210,38 @@ let utils.build = pkgs.writeDash "utils.build" '' set -efu - ${pkgs.nix}/bin/nix-build \ - -Q \ - --no-out-link \ - --show-trace \ - -E "with import <stockholm>; $1" \ - -I "$target_path" \ - 2>&1 | - ${pkgs.whatsupnix}/bin/whatsupnix + if test "$verbose" = true; then + ${pkgs.nix}/bin/nix-build \ + --no-out-link \ + --show-trace \ + -E "with import <stockholm>; $1" \ + -I "$target_path" + else + ${pkgs.nix}/bin/nix-build \ + -Q \ + --no-out-link \ + --show-trace \ + -E "with import <stockholm>; $1" \ + -I "$target_path" \ + 2>&1 | + ${pkgs.whatsupnix}/bin/whatsupnix + fi ''; utils.deploy = pkgs.writeDash "utils.deploy" '' - set -efu - PATH=/run/current-system/sw/bin nixos-rebuild switch \ - -Q \ - --show-trace \ - -I "$target_path" \ - 2>&1 | - ${pkgs.whatsupnix}/bin/whatsupnix + set -xefu + if test "$verbose" = true; then + PATH=/run/current-system/sw/bin nixos-rebuild switch \ + --show-trace \ + -I "$target_path" + else + PATH=/run/current-system/sw/bin nixos-rebuild switch \ + -Q \ + --show-trace \ + -I "$target_path" \ + 2>&1 | + ${pkgs.whatsupnix}/bin/whatsupnix + fi ''; shell.get-version = pkgs.writeDash "shell.get-version" '' @@ -270,6 +288,7 @@ in pkgs.stdenv.mkDerivation { export HOSTNAME="$(${pkgs.nettools}/bin/hostname)" export STOCKHOLM_VERSION="''${STOCKHOLM_VERSION-$(${shell.get-version})}" + export verbose="''${verbose-false}" PS1='\[\e[38;5;162m\]\w\[\e[0m\] ' ''; |