diff --git a/pkgs/default.nix b/pkgs/default.nix index ebf69d2..58cc494 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -43,6 +43,8 @@ in { taskwarrior-hooks = callPackage ./taskwarrior-hooks { }; + terminal-tools = callPackage ./terminal-tools { }; + # use upstream only for package tests # memo = callPackage ./memo {}; diff --git a/pkgs/q/default.nix b/pkgs/q/default.nix index 01cec43..41aa8c6 100644 --- a/pkgs/q/default.nix +++ b/pkgs/q/default.nix @@ -5,16 +5,8 @@ , enableBattery ? true, ... }: let - hrule = '' - hrule_cols=$(${pkgs.ncurses}/bin/tput cols) - hrule_index=0 - while [ $hrule_index -lt $hrule_cols ] - do - echo -n '─' - hrule_index=$(( 1 + $hrule_index )) - done - echo - ''; + + hrule = ''${pkgs.terminal-tools}/bin/hrule''; q-cal = let @@ -310,8 +302,17 @@ let 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 = '' - ${pkgs.taskwarrior}/bin/task export +checklist status:pending | \ + ${pkgs.taskwarrior}/bin/task export +checklist status:pending +READY | \ ${pkgs.jq}/bin/jq \ --raw-output ' sort_by(.description) | reverse | @@ -321,7 +322,9 @@ let ''; 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 <(...) @@ -344,4 +347,5 @@ in pkgs.writers.writeBashBin "q" '' ${hrule} ${q-task-checklist} ${hrule} + ${q-show-users} '' diff --git a/pkgs/terminal-tools/default.nix b/pkgs/terminal-tools/default.nix new file mode 100644 index 0000000..2d5aa3c --- /dev/null +++ b/pkgs/terminal-tools/default.nix @@ -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; + }; +} +