about summary refs log tree commit diff
path: root/pkgs/applications/office/timetrap/default.nix
blob: 4ec8101db0e586c54c3431bd252cf3b07d20aa0e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
{ stdenv
, lib
, pkgs
, bundlerEnv
, bundlerApp
, bundlerUpdateScript
, installShellFiles
}:

let
  ttBundlerApp = bundlerApp {
    pname = "timetrap";
    gemdir = ./.;
    exes = [ "t" "timetrap" ];

    passthru.updateScript = bundlerUpdateScript "timetrap";
  };

  ttGem = bundlerEnv {
    pname = "timetrap";
    gemdir = ./.;
  };

in

stdenv.mkDerivation {
  name = "timetrap";

  dontUnpack = true;

  nativeBuildInputs = [ installShellFiles ];

  installPhase = ''
    mkdir $out;
    cd $out;

    mkdir bin; pushd bin;
    ln -vs ${ttBundlerApp}/bin/t;
    ln -vs ${ttBundlerApp}/bin/timetrap;
    popd;

    for c in t timetrap; do
      installShellCompletion --cmd $c --bash ${ttGem}/lib/ruby/gems/*/gems/timetrap*/completions/bash/*;
      installShellCompletion --cmd $c --zsh ${ttGem}/lib/ruby/gems/*/gems/timetrap*/completions/zsh/*;
    done;
  '';

  meta = with lib; {
    description = "Simple command line time tracker written in ruby";
    homepage    = "https://github.com/samg/timetrap";
    license     = licenses.mit;
    maintainers = with maintainers; [ jerith666 manveru nicknovitski ];
    platforms   = platforms.unix;
  };
}