summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/ti/tinystatus/package.nix
blob: 59569bbd3faa9b675a11cfb862ef35f90be30ee4 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
{
  lib,
  stdenvNoCC,
  fetchFromGitHub,
  makeBinaryWrapper,
  coreutils,
  curl,
  findutils,
  gawk,
  gnugrep,
  gnused,
  mktemp,
  netcat,
  unixtools,
}:

stdenvNoCC.mkDerivation (finalAttrs: {
  pname = "tinystatus";
  version = "0-unstable-2025-03-27";

  src = fetchFromGitHub {
    owner = "bderenzo";
    repo = "tinystatus";
    rev = "169ee0bb2efe4531080936d1e2a46e451feebe3e";
    hash = "sha256-nPrABKKIDP1n1rhcojFJJ15kqa5b4s7F/wMAgD/eVBw=";
  };

  nativeBuildInputs = [ makeBinaryWrapper ];

  installPhase = ''
    runHook preInstall

    install -Dm755 tinystatus $out/bin/tinystatus
    wrapProgram $out/bin/tinystatus \
      --set PATH "${
        lib.makeBinPath [
          coreutils
          curl
          findutils
          gawk
          gnugrep
          gnused
          mktemp
          netcat
          unixtools.ping
        ]
      }"

    runHook postInstall
  '';

  doInstallCheck = true;

  installCheckPhase = ''
    runHook preInstallCheck

    cat <<EOF >test.csv
    ping, 0, testing, this.should.fail.example.com
    EOF

    $out/bin/tinystatus test.csv | grep Disrupted

    runHook postInstallCheck
  '';

  meta = {
    description = "Static HTML status page generator written in pure shell";
    mainProgram = "tinystatus";
    homepage = "https://github.com/bderenzo/tinystatus";
    license = lib.licenses.mit;
    platforms = lib.platforms.unix;
    maintainers = with lib.maintainers; [ matthewcroughan ];
  };
})