stockholm/krebs/5pkgs/simple/cac-api/default.nix

46 lines
1014 B
Nix
Raw Normal View History

{ fetchgit, lib, stdenv
2022-09-27 10:24:05 +00:00
, bc, cac-cert, coreutils, curl, dash, gnugrep, gnused, inotify-tools, jq, ncurses, openssh, sshpass
}:
2015-08-05 22:21:40 +00:00
stdenv.mkDerivation {
2016-02-22 12:24:03 +00:00
name = "cac-api-1.1.2";
2015-08-05 22:21:40 +00:00
src = fetchgit {
2016-11-10 22:15:33 +00:00
url = http://cgit.ni.krebsco.de/cac-api;
2016-02-22 12:24:03 +00:00
rev = "67e93510e7742acae44db30275abbfe671aa9b7b";
sha256 = "1vxh57j7vrq5sg9j1sam0538kkkhqpgf230vvdz2ifzgkj01z27l";
2015-08-05 22:21:40 +00:00
};
phases = [
"unpackPhase"
"installPhase"
];
installPhase = ''
mkdir -p $out/bin
{ cat <<\EOF
#! ${dash}/bin/dash
export PATH=${lib.makeBinPath [
bc
coreutils
curl
gnugrep
gnused
2022-09-27 10:24:05 +00:00
inotify-tools
jq
ncurses
openssh
sshpass
2016-02-22 10:33:51 +00:00
]}:"$PATH"
EOF
# [1]: Disable fetching tasks; listtasks is currently broken:
# Unknown column 'iod.apitask.cid' in 'field list'
sed '
/^\s*tasks \\$/d; # [1]
2016-02-04 00:55:59 +00:00
s|\<_cac_exec curl|<${cac-cert} & --cacert /dev/stdin|
' cac-api
} > $out/bin/cac-api
chmod +x $out/bin/cac-api
'';
2015-08-05 22:21:40 +00:00
}