aboutsummaryrefslogtreecommitdiff
path: root/modules/pkgs/check_aws_s3_file/default.nix
blob: df84c7965ebbc707e52870730eade5cf8837b616 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{ stdenv, pkgs, makeWrapper }:

stdenv.mkDerivation {
  name = "check_aws_s3_file";
  outputs = [ "out" "conf" ];
  unpackPhase = ":";
  nativeBuildInputs = [ makeWrapper ];
  installPhase = ''
    mkdir -p $out/bin

    cp ${./check_aws_s3_file} $out/bin/check_aws_s3_file
    cp ${./check_aws_s3_file.conf} $conf

    chmod +x "$out/bin/"*

    substituteInPlace "$conf" \
      --replace check_aws_s3_file "$out/bin/check_aws_s3_file"

    wrapProgram "$out/bin/check_aws_s3_file" \
      --prefix PATH : "${pkgs.awscli}/bin:${pkgs.gnugrep}/bin:${pkgs.jq}/bin"
  '';
}