Merge remote-tracking branch 'ni/master'

This commit is contained in:
lassulus 2017-09-20 12:15:54 +02:00
commit 2d9c74b4f3
6 changed files with 65 additions and 8 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
/.graveyard
/TODO

View File

@ -1,3 +1,4 @@
- /.git
- /.graveyard
- /TODO
P /.version-suffix

View File

@ -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>

View File

@ -24,6 +24,10 @@ foldl' mergeAttrs {}
"$@"
'';
gitAndTools = super.gitAndTools // {
inherit (self) diff-so-fancy;
};
ff = self.writeDashBin "ff" ''
exec ${self.firefoxWrapper}/bin/firefox "$@"
'';

View File

@ -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 ];
};
}

View File

@ -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}) || :
''