summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2017-09-20 12:15:54 +0200
committerlassulus <lassulus@lassul.us>2017-09-20 12:15:54 +0200
commit2d9c74b4f3fa760c4be9c754abf94e24c27eb70c (patch)
tree4140680e93cb9e09b772a4212b460974c962eaf7
parentdcde03342c040ca00f2b80ca4d1c3bb68844b105 (diff)
parent6fed88c5611f71726c82af93d0df0ac4112e9814 (diff)
Merge remote-tracking branch 'ni/master'
-rw-r--r--.gitignore1
-rw-r--r--.rsync-filter1
-rw-r--r--tv/1systems/wu/config.nix1
-rw-r--r--tv/5pkgs/default.nix4
-rw-r--r--tv/5pkgs/simple/diff-so-fancy.nix48
-rw-r--r--tv/5pkgs/simple/q/default.nix18
6 files changed, 65 insertions, 8 deletions
diff --git a/.gitignore b/.gitignore
index 1ce082113..e1c6ef949 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
/.graveyard
+/TODO
diff --git a/.rsync-filter b/.rsync-filter
index 364a79864..67ec05fc3 100644
--- a/.rsync-filter
+++ b/.rsync-filter
@@ -1,3 +1,4 @@
- /.git
- /.graveyard
+- /TODO
P /.version-suffix
diff --git a/tv/1systems/wu/config.nix b/tv/1systems/wu/config.nix
index 79b5aa269..5c593894a 100644
--- a/tv/1systems/wu/config.nix
+++ b/tv/1systems/wu/config.nix
@@ -8,7 +8,6 @@ with import <stockholm/lib>;
<stockholm/tv/2configs/hw/w110er.nix>
<stockholm/tv/2configs/exim-retiolum.nix>
<stockholm/tv/2configs/gitrepos.nix>
- <stockholm/tv/2configs/im.nix>
<stockholm/tv/2configs/mail-client.nix>
<stockholm/tv/2configs/man.nix>
<stockholm/tv/2configs/nginx/public_html.nix>
diff --git a/tv/5pkgs/default.nix b/tv/5pkgs/default.nix
index 8a7a613ba..1796609a9 100644
--- a/tv/5pkgs/default.nix
+++ b/tv/5pkgs/default.nix
@@ -24,6 +24,10 @@ foldl' mergeAttrs {}
"$@"
'';
+ gitAndTools = super.gitAndTools // {
+ inherit (self) diff-so-fancy;
+ };
+
ff = self.writeDashBin "ff" ''
exec ${self.firefoxWrapper}/bin/firefox "$@"
'';
diff --git a/tv/5pkgs/simple/diff-so-fancy.nix b/tv/5pkgs/simple/diff-so-fancy.nix
new file mode 100644
index 000000000..9ce6d9234
--- /dev/null
+++ b/tv/5pkgs/simple/diff-so-fancy.nix
@@ -0,0 +1,48 @@
+{stdenv, git, perl, ncurses, coreutils, fetchFromGitHub, makeWrapper, ...}:
+
+stdenv.mkDerivation rec {
+ name = "diff-so-fancy-${version}";
+ version = "ed8cf17";
+
+ src = fetchFromGitHub {
+ owner = "so-fancy";
+ repo = "diff-so-fancy";
+ rev = "ed8cf1763d38bdd79ceb55a73b9ce7e30f1e184d";
+ sha256 = "176qn0w2rn6mr5ymvkblyiznqq7yyibfsnnjfivcyhz69w6yr9r9";
+ };
+
+ # Perl is needed here for patchShebangs
+ nativeBuildInputs = [ perl makeWrapper ];
+
+ buildPhase = null;
+
+ installPhase = ''
+ mkdir -p $out/bin $out/lib/diff-so-fancy
+
+ # diff-so-fancy executable searches for it's library relative to
+ # itself, so we are copying executable to lib, and only symlink it
+ # from bin/
+ cp diff-so-fancy $out/lib/diff-so-fancy
+ cp -r lib $out/lib/diff-so-fancy
+ ln -s $out/lib/diff-so-fancy/diff-so-fancy $out/bin
+
+ # ncurses is needed for `tput`
+ wrapProgram $out/lib/diff-so-fancy/diff-so-fancy \
+ --prefix PATH : "${git}/share/git/contrib/diff-highlight" \
+ --prefix PATH : "${git}/bin" \
+ --prefix PATH : "${coreutils}/bin" \
+ --prefix PATH : "${ncurses.out}/bin"
+ '';
+
+ meta = with stdenv.lib; {
+ homepage = https://github.com/so-fancy/diff-so-fancy;
+ description = "Good-looking diffs filter for git";
+ license = licenses.mit;
+ platforms = platforms.all;
+ longDescription = ''
+ diff-so-fancy builds on the good-lookin' output of git contrib's
+ diff-highlight to upgrade your diffs' appearances.
+ '';
+ maintainers = with maintainers; [ fpletz ];
+ };
+}
diff --git a/tv/5pkgs/simple/q/default.nix b/tv/5pkgs/simple/q/default.nix
index 2e7aa5cf2..655c75e1b 100644
--- a/tv/5pkgs/simple/q/default.nix
+++ b/tv/5pkgs/simple/q/default.nix
@@ -262,7 +262,7 @@ let
'';
q-todo = ''
- TODO_file=$HOME/TODO
+ TODO_file=$PWD/TODO
if test -e "$TODO_file"; then
${pkgs.coreutils}/bin/cat "$TODO_file" \
| ${pkgs.gawk}/bin/gawk -v now=$(${pkgs.coreutils}/bin/date +%s) '
@@ -294,13 +294,7 @@ in
pkgs.writeBashBin "q" ''
set -eu
export PATH=/var/empty
- (${q-todo}) || :
- if [ "$PWD" != "$HOME" ]; then
- (HOME=$PWD; ${q-todo}) || :
- fi
- echo
${q-cal}
- echo
${q-isodate}
${q-sgtdate}
(${q-gitdir}) &
@@ -311,4 +305,14 @@ pkgs.writeBashBin "q" ''
(${q-online}) &
(${q-thermal_zone}) &
wait
+ if test "$PWD" != "$HOME" && test -e "$HOME/TODO"; then
+ TODO_home_entries=$(cd; (${q-todo}) | ${pkgs.coreutils}/bin/wc -l)
+ if test "$TODO_home_entries" = 1; then
+ TODO_format='There is %d entry in ~/TODO'
+ else
+ TODO_format='There are %d entries in ~/TODO'
+ fi
+ printf "\x1b[38;5;238m$TODO_format\x1b[m\n" "$TODO_home_entries"
+ fi
+ (${q-todo}) || :
''