aboutsummaryrefslogtreecommitdiff
path: root/modules/pkgs/check_mdstat/default.nix
blob: 5e645fd6676516a6eee2be662cf780d80a8b0d75 (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
{ stdenv, gawk, gnugrep }:

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

    cp "$src" $out/bin/check_mdstat

    substituteInPlace "$out/bin/"* \
      --replace awk '${gawk}/bin/awk' \
      --replace grep '${gnugrep}/bin/grep'

    chmod +x "$out/bin/"*

    cat <<CONF > $conf
    object CheckCommand "mdstat" {
      import "plugin-check-command"
      command = [ "$out/bin/check_mdstat" ]
    }
    CONF
  '';
}