Merge pull request #146540 from helsinki-systems/feat/icinga2-lto

icinga2: Enable LTO and tests + cleanup doc

authored by ajs124 and committed by GitHub 1560cc0d d61d1031

+14 -22
+14 -22
pkgs/servers/monitoring/icinga2/default.nix
··· 1 - { stdenv, lib, fetchFromGitHub, fetchpatch, cmake, flex, bison, systemd 2 - , boost, openssl, patchelf, mariadb-connector-c, postgresql, zlib 3 # Databases 4 , withMysql ? true, withPostgresql ? false 5 # Features ··· 22 ./etc-icinga2.patch # Makes /etc/icinga2 relative to / instead of the store path 23 ./no-systemd-service.patch # Prevent systemd service from being written to /usr 24 ./no-var-directories.patch # Prevent /var directories from being created 25 - # Fix the non-unity build 26 - (fetchpatch { 27 - url = "https://github.com/Icinga/icinga2/commit/2ad0a4b8c3852ad937fec9fc85780230257c821e.patch"; 28 - sha256 = "sha256:06qn7x73zbccmd8ycj46a29x2rr6qjwg0rr831wc2gc6q2k9d2g0"; 29 - }) 30 ]; 31 32 cmakeFlags = let ··· 40 "-DMYSQL_INCLUDE_DIR=${mariadb-connector-c.dev}/include/mariadb" 41 "-DMYSQL_LIB=${mariadb-connector-c.out}/lib/mariadb/libmysqlclient.a" 42 "-DICINGA2_PLUGINDIR=bin" 43 - "-DICINGA2_UNITY_BUILD=no" 44 # Features 45 (mkFeatureFlag "MYSQL" withMysql) 46 (mkFeatureFlag "PGSQL" withPostgresql) ··· 54 "-DICINGA2_USER=icinga2" 55 "-DICINGA2_GROUP=icinga2" 56 "-DICINGA2_GIT_VERSION_INFO=OFF" 57 - "-DICINGA2_WITH_TESTS=OFF" 58 "-DUSE_SYSTEMD=ON" 59 ]; 60 61 buildInputs = [ boost openssl systemd ] 62 ++ lib.optional withPostgresql postgresql; 63 64 nativeBuildInputs = [ cmake flex bison patchelf ]; 65 66 postFixup = '' 67 rm -r $out/etc/logrotate.d $out/etc/sysconfig $out/lib/icinga2/prepare-dirs 68 69 # Fix hardcoded paths 70 sed -i 's:/usr/bin/::g' $out/etc/icinga2/scripts/* 71 72 - # Cleanup sbin 73 sed -i 's/sbin/bin/g' $out/lib/icinga2/safe-reload 74 rm $out/sbin 75 76 ${lib.optionalString withMysql '' ··· 83 ''} 84 ''; 85 86 - vim = stdenv.mkDerivation { 87 - pname = "vim-icinga2"; 88 - inherit version src; 89 - 90 - dontConfigure = true; 91 - dontBuild = true; 92 - 93 - installPhase = '' 94 - mkdir -p $out/share/vim-plugins 95 - cp -r tools/syntax/vim $out/share/vim-plugins/icinga2 96 - ''; 97 - }; 98 99 meta = { 100 description = "Open source monitoring system";
··· 1 + { stdenv, runCommand, lib, fetchFromGitHub, fetchpatch, cmake, flex, bison, systemd 2 + , boost, openssl, patchelf, mariadb-connector-c, postgresql, zlib, tzdata 3 # Databases 4 , withMysql ? true, withPostgresql ? false 5 # Features ··· 22 ./etc-icinga2.patch # Makes /etc/icinga2 relative to / instead of the store path 23 ./no-systemd-service.patch # Prevent systemd service from being written to /usr 24 ./no-var-directories.patch # Prevent /var directories from being created 25 ]; 26 27 cmakeFlags = let ··· 35 "-DMYSQL_INCLUDE_DIR=${mariadb-connector-c.dev}/include/mariadb" 36 "-DMYSQL_LIB=${mariadb-connector-c.out}/lib/mariadb/libmysqlclient.a" 37 "-DICINGA2_PLUGINDIR=bin" 38 + "-DICINGA2_LTO_BUILD=yes" 39 # Features 40 (mkFeatureFlag "MYSQL" withMysql) 41 (mkFeatureFlag "PGSQL" withPostgresql) ··· 49 "-DICINGA2_USER=icinga2" 50 "-DICINGA2_GROUP=icinga2" 51 "-DICINGA2_GIT_VERSION_INFO=OFF" 52 "-DUSE_SYSTEMD=ON" 53 ]; 54 + 55 + outputs = [ "out" "doc" ]; 56 57 buildInputs = [ boost openssl systemd ] 58 ++ lib.optional withPostgresql postgresql; 59 60 nativeBuildInputs = [ cmake flex bison patchelf ]; 61 62 + doCheck = true; 63 + checkInputs = [ tzdata ]; # legacytimeperiod/dst needs this 64 + 65 postFixup = '' 66 rm -r $out/etc/logrotate.d $out/etc/sysconfig $out/lib/icinga2/prepare-dirs 67 68 # Fix hardcoded paths 69 sed -i 's:/usr/bin/::g' $out/etc/icinga2/scripts/* 70 71 + # Get rid of sbin 72 sed -i 's/sbin/bin/g' $out/lib/icinga2/safe-reload 73 + sed -i 's/sbin/bin/g' $out/bin/icinga2 74 rm $out/sbin 75 76 ${lib.optionalString withMysql '' ··· 83 ''} 84 ''; 85 86 + vim = runCommand "vim-icinga2-${version}" {} '' 87 + mkdir -p $out/share/vim-plugins 88 + cp -r "${src}/tools/syntax/vim" $out/share/vim-plugins/icinga2 89 + ''; 90 91 meta = { 92 description = "Open source monitoring system";