summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs/cac.nix
blob: 3322e1a13953a96e0766a818d566e724d3c7b99b (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
{ stdenv, fetchgit, coreutils, curl, gnused, jq, ... }:

stdenv.mkDerivation {
  name = "cac";

  src = fetchgit {
    url = http://cgit.cd.retiolum/cac;
    rev = "07ef31c50613634e88a31233d1fcd2ec3e52bfe8";
    sha256 = "4e94709a3f580a53983ca418fa0b470817ac917aa1b2d095f2420afd36ea9158";
  };

  phases = [
    "unpackPhase"
    "installPhase"
  ];

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

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

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