]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - default.nix
Add cnagios program
[perso/Immae/Config/Nix.git] / default.nix
index 28767a9b2dea0225c2da423ea8be9b4789964128..92dea9cdb5c19a22730b134f66c87a1060343f09 100644 (file)
@@ -1,6 +1,21 @@
 with import <nixpkgs> {};
 let
   nixpkgs = import <nixpkgs> {};
+  postHook =  ''
+    header() {
+      echo -ne "\033[1;36m"
+      echo -n "$1"
+      echo -e "\033[0m"
+    }
+
+    echoCmd() {
+      printf "\033[1;34m%s:\033[0m" "$1"
+      shift
+      printf ' %q' "$@"
+      echo
+    }
+  '';
+
   fetchedGithub = path:
     let
       json = lib.importJSON path;
@@ -164,6 +179,27 @@ let
     '';
   };
 
+  cnagios = stdenv.mkDerivation (fetchedGithub ./fetched/cnagios.json // rec {
+    configureFlags = [
+      "--with-etc-dir=/etc/cnagios"
+      "--with-var-dir=/var/lib/naemon"
+      "--with-nagios-data=4"
+    ];
+
+    prePatch = ''
+      sed -i -e "s/-lcurses/-lncurses/" Makefile.in
+    '';
+    installPhase = ''
+      install -dm755 $out/share/doc/cnagios
+      install -Dm644 cnagiosrc $out/share/doc/cnagios/
+      install -Dm644 cnagios.help $out/share/doc/cnagios/
+      install -Dm644 cnagios.pl $out/share/doc/cnagios/
+      install -dm755 $out/bin
+      install -Dm755 cnagios $out/bin/
+    '';
+    propagatedBuildInputs = [ perl ncurses ];
+  });
+
 # https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh
 # https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks
 in
@@ -193,5 +229,6 @@ in
     inherit note terminal_velocity;
     inherit mtop;
     inherit tiv;
+    inherit cnagios;
     #inherit nixos;
   }