add terminal-tool

This commit is contained in:
Ingolf Wagner 2019-12-31 13:40:49 +13:00
parent 8d0c49981f
commit 9aec67c1db
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B
3 changed files with 44 additions and 12 deletions

View file

@ -43,6 +43,8 @@ in {
taskwarrior-hooks = callPackage ./taskwarrior-hooks { }; taskwarrior-hooks = callPackage ./taskwarrior-hooks { };
terminal-tools = callPackage ./terminal-tools { };
# use upstream only for package tests # use upstream only for package tests
# memo = callPackage ./memo {}; # memo = callPackage ./memo {};

View file

@ -5,16 +5,8 @@
, enableBattery ? true, ... }: , enableBattery ? true, ... }:
let let
hrule = ''
hrule_cols=$(${pkgs.ncurses}/bin/tput cols) hrule = ''${pkgs.terminal-tools}/bin/hrule'';
hrule_index=0
while [ $hrule_index -lt $hrule_cols ]
do
echo -n ''
hrule_index=$(( 1 + $hrule_index ))
done
echo
'';
q-cal = let q-cal = let
@ -310,8 +302,17 @@ let
done done
''; '';
q-show-users = ''
${pkgs.procps}/bin/ps aux \
| ${pkgs.gawk}/bin/awk '{ print $1 }' \
| ${pkgs.gnused}/bin/sed '1 d' \
| ${pkgs.coreutils}/bin/sort \
| ${pkgs.coreutils}/bin/uniq \
| ${pkgs.utillinux}/bin/column
'';
q-task-checklist = '' q-task-checklist = ''
${pkgs.taskwarrior}/bin/task export +checklist status:pending | \ ${pkgs.taskwarrior}/bin/task export +checklist status:pending +READY | \
${pkgs.jq}/bin/jq \ ${pkgs.jq}/bin/jq \
--raw-output ' --raw-output '
sort_by(.description) | reverse | sort_by(.description) | reverse |
@ -321,7 +322,9 @@ let
''; '';
q-task-active = '' q-task-active = ''
${pkgs.taskwarrior}/bin/task export +ACTIVE status:pending | ${pkgs.jq}/bin/jq --raw-output '.[] | " \(.id) \(.description)"' ${pkgs.taskwarrior}/bin/task export \
+ACTIVE status:pending \
| ${pkgs.jq}/bin/jq --raw-output '.[] | " \(.id) \(.description)"'
''; '';
# bash needed for <(...) # bash needed for <(...)
@ -344,4 +347,5 @@ in pkgs.writers.writeBashBin "q" ''
${hrule} ${hrule}
${q-task-checklist} ${q-task-checklist}
${hrule} ${hrule}
${q-show-users}
'' ''

View file

@ -0,0 +1,26 @@
{ rustPlatform, fetchgit, stdenv, ... }:
rustPlatform.buildRustPackage rec {
name = "terminal-tools-${version}";
version = "0.1.0";
#src = ./.;
src = fetchgit {
url = "https://git.ingolf-wagner.de/palo/terminal-tools";
rev = "e77560d04aa6b86da2a8dc235c7168ca9cdd7d45";
sha256 = "087cp0m42x3rjkkhh3zi48ahz4qkavr7lgc9fy299m9gjy6alb7p";
};
cargoSha256 = "0dgbw6idlzzpgljv0lxavimh1h8qlib0qrcn92f5imy6a12phrmm";
verifyCargoDeps = true;
meta = with stdenv.lib; {
description = "tools I use in my shell scripts which should be fast";
homepage = "https://git.ingolf-wagner.de/palo/terminal-tools";
license = licenses.gplv3;
maintainers = [ maintainers.mrVanDalo ];
platforms = platforms.all;
};
}