summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs/cac.nix
blob: 49a5bd276b58107b5032530599d5b25c4373fe9d (plain)
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
{ stdenv, fetchgit, coreutils, curl, gnused, jq, ncurses, sshpass, ... }:

stdenv.mkDerivation {
  name = "cac";

  src = fetchgit {
    url = http://cgit.cd.retiolum/cac;
    rev = "0fc9cbeba4060380f698f51bb74081e2fcefadf3";
    sha256 = "9759c78aa9aa04ab82486d0f24264bff1081513bc07cac0f8b3c0bdf52260fb3";
  };

  phases = [
    "unpackPhase"
    "installPhase"
  ];

  installPhase =
    let
      path = stdenv.lib.makeSearchPath "bin" [
        coreutils
        curl
        gnused
        jq
        ncurses
        sshpass
      ];
    in
    ''
      mkdir -p $out/bin

      sed \
        's,^\(  true) \)\(cac "$@";;\)$,\1 PATH=${path}${PATH+:$PATH} \2,' \
        < ./cac \
        > $out/bin/cac

      chmod +x $out/bin/cac
    '';
}