summary refs log tree commit diff
path: root/pkgs/applications/office/timetrap/default.nix
blob: 7ece5e9b4b03041b0344e1201e031bd2570f25b4 (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 = "A 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;
  };
}