aboutsummaryrefslogtreecommitdiff
path: root/modules/pkgs/check_systemd/default.nix
blob: da92a64614919d9f7d0f4af583b5c1f047bf9de5 (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
{ stdenv, gnused }:

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

    cp "$src" $out/bin/check_systemd

    substituteInPlace "$out/bin/"* \
      --replace sed '${gnused}/bin/sed'

    chmod +x "$out/bin/"*

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