summary refs log tree commit diff
path: root/pkgs/servers/monitoring/icinga2/default.nix
diff options
context:
space:
mode:
authorJanne Heß <janne@hess.ooo>2021-11-18 22:11:37 +0100
committerJanne Heß <janne@hess.ooo>2021-11-18 22:16:39 +0100
commiteaab9909ca70e9ef67703cfa8e72086996810692 (patch)
tree180861e261457df9b52969e141e32edd89c19505 /pkgs/servers/monitoring/icinga2/default.nix
parente4a4f3ba55f0f9d379760b6541cec093635526e8 (diff)
downloadnixpkgs-eaab9909ca70e9ef67703cfa8e72086996810692.tar
nixpkgs-eaab9909ca70e9ef67703cfa8e72086996810692.tar.gz
nixpkgs-eaab9909ca70e9ef67703cfa8e72086996810692.tar.bz2
nixpkgs-eaab9909ca70e9ef67703cfa8e72086996810692.tar.lz
nixpkgs-eaab9909ca70e9ef67703cfa8e72086996810692.tar.xz
nixpkgs-eaab9909ca70e9ef67703cfa8e72086996810692.tar.zst
nixpkgs-eaab9909ca70e9ef67703cfa8e72086996810692.zip
icinga2: Enable LTO and tests + cleanup doc
Also enable unity build because it makes LTO more efficient - we don't
need the non-unity fix then.

Also move the docs into their own output because most people using
Icinga in a cluster only need the docs on one machine.

Also clean the vim output to use `runCommand`
Diffstat (limited to 'pkgs/servers/monitoring/icinga2/default.nix')
-rw-r--r--pkgs/servers/monitoring/icinga2/default.nix36
1 files changed, 14 insertions, 22 deletions
diff --git a/pkgs/servers/monitoring/icinga2/default.nix b/pkgs/servers/monitoring/icinga2/default.nix
index 0b039bf21a7..b85cccf1838 100644
--- a/pkgs/servers/monitoring/icinga2/default.nix
+++ b/pkgs/servers/monitoring/icinga2/default.nix
@@ -1,5 +1,5 @@
-{ stdenv, lib, fetchFromGitHub, fetchpatch, cmake, flex, bison, systemd
-, boost, openssl, patchelf, mariadb-connector-c, postgresql, zlib
+{ stdenv, runCommand, lib, fetchFromGitHub, fetchpatch, cmake, flex, bison, systemd
+, boost, openssl, patchelf, mariadb-connector-c, postgresql, zlib, tzdata
 # Databases
 , withMysql ? true, withPostgresql ? false
 # Features
@@ -22,11 +22,6 @@ stdenv.mkDerivation rec {
     ./etc-icinga2.patch # Makes /etc/icinga2 relative to / instead of the store path
     ./no-systemd-service.patch # Prevent systemd service from being written to /usr
     ./no-var-directories.patch # Prevent /var directories from being created
-    # Fix the non-unity build
-    (fetchpatch {
-      url = "https://github.com/Icinga/icinga2/commit/2ad0a4b8c3852ad937fec9fc85780230257c821e.patch";
-      sha256 = "sha256:06qn7x73zbccmd8ycj46a29x2rr6qjwg0rr831wc2gc6q2k9d2g0";
-    })
   ];
 
   cmakeFlags = let
@@ -40,7 +35,7 @@ stdenv.mkDerivation rec {
     "-DMYSQL_INCLUDE_DIR=${mariadb-connector-c.dev}/include/mariadb"
     "-DMYSQL_LIB=${mariadb-connector-c.out}/lib/mariadb/libmysqlclient.a"
     "-DICINGA2_PLUGINDIR=bin"
-    "-DICINGA2_UNITY_BUILD=no"
+    "-DICINGA2_LTO_BUILD=yes"
     # Features
     (mkFeatureFlag "MYSQL" withMysql)
     (mkFeatureFlag "PGSQL" withPostgresql)
@@ -54,23 +49,28 @@ stdenv.mkDerivation rec {
     "-DICINGA2_USER=icinga2"
     "-DICINGA2_GROUP=icinga2"
     "-DICINGA2_GIT_VERSION_INFO=OFF"
-    "-DICINGA2_WITH_TESTS=OFF"
     "-DUSE_SYSTEMD=ON"
   ];
 
+  outputs = [ "out" "doc" ];
+
   buildInputs = [ boost openssl systemd ]
     ++ lib.optional withPostgresql postgresql;
 
   nativeBuildInputs = [ cmake flex bison patchelf ];
 
+  doCheck = true;
+  checkInputs = [ tzdata ]; # legacytimeperiod/dst needs this
+
   postFixup = ''
     rm -r $out/etc/logrotate.d $out/etc/sysconfig $out/lib/icinga2/prepare-dirs
 
     # Fix hardcoded paths
     sed -i 's:/usr/bin/::g' $out/etc/icinga2/scripts/*
 
-    # Cleanup sbin
+    # Get rid of sbin
     sed -i 's/sbin/bin/g' $out/lib/icinga2/safe-reload
+    sed -i 's/sbin/bin/g' $out/bin/icinga2
     rm $out/sbin
 
     ${lib.optionalString withMysql ''
@@ -83,18 +83,10 @@ stdenv.mkDerivation rec {
     ''}
   '';
 
-  vim = stdenv.mkDerivation {
-    pname = "vim-icinga2";
-    inherit version src;
-
-    dontConfigure = true;
-    dontBuild = true;
-
-    installPhase = ''
-      mkdir -p $out/share/vim-plugins
-      cp -r tools/syntax/vim $out/share/vim-plugins/icinga2
-    '';
-  };
+  vim = runCommand "vim-icinga2-${version}" {} ''
+    mkdir -p $out/share/vim-plugins
+    cp -r "${src}/tools/syntax/vim" $out/share/vim-plugins/icinga2
+  '';
 
   meta = {
     description = "Open source monitoring system";