push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,133 @@
{
stdenv,
runCommand,
lib,
fetchFromGitHub,
cmake,
flex,
bison,
systemd,
boost186,
libedit,
openssl,
patchelf,
mariadb-connector-c,
libpq,
zlib,
tzdata,
# Databases
withMysql ? true,
withPostgresql ? false,
# Features
withChecker ? true,
withCompat ? false,
withLivestatus ? false,
withNotification ? true,
withPerfdata ? true,
withIcingadb ? true,
nameSuffix ? "",
}:
stdenv.mkDerivation rec {
pname = "icinga2${nameSuffix}";
version = "2.15.0";
src = fetchFromGitHub {
owner = "icinga";
repo = "icinga2";
rev = "v${version}";
hash = "sha256-IuK6kD2OBAm7bKtPcMnplwNSGyGUcX3UWiwm8Vry1is=";
};
patches = [
./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
];
cmakeFlags =
let
mkFeatureFlag = label: value: "-DICINGA2_WITH_${label}=${if value then "ON" else "OFF"}";
in
[
# Paths
"-DCMAKE_INSTALL_SYSCONFDIR=etc"
"-DCMAKE_INSTALL_LOCALSTATEDIR=/var"
"-DCMAKE_INSTALL_FULL_SBINDIR=bin"
"-DICINGA2_RUNDIR=/run"
"-DMYSQL_INCLUDE_DIR=${mariadb-connector-c.dev}/include/mariadb"
"-DMYSQL_LIB=${mariadb-connector-c.out}/lib/mariadb/libmysqlclient.a"
"-DICINGA2_PLUGINDIR=bin"
"-DICINGA2_LTO_BUILD=yes"
# Features
(mkFeatureFlag "MYSQL" withMysql)
(mkFeatureFlag "PGSQL" withPostgresql)
(mkFeatureFlag "CHECKER" withChecker)
(mkFeatureFlag "COMPAT" withCompat)
(mkFeatureFlag "LIVESTATUS" withLivestatus)
(mkFeatureFlag "NOTIFICATION" withNotification)
(mkFeatureFlag "PERFDATA" withPerfdata)
(mkFeatureFlag "ICINGADB" withIcingadb)
# Misc.
"-DICINGA2_USER=icinga2"
"-DICINGA2_GROUP=icinga2"
"-DICINGA2_GIT_VERSION_INFO=OFF"
"-DUSE_SYSTEMD=ON"
];
outputs = [
"out"
"doc"
];
buildInputs = [
boost186
libedit
openssl
systemd
]
++ lib.optional withPostgresql libpq;
nativeBuildInputs = [
cmake
flex
bison
patchelf
];
doCheck = true;
nativeCheckInputs = [ 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/*
# Get rid of sbin
sed -i 's/sbin/bin/g' $out/lib/icinga2/safe-reload
rm $out/sbin
${lib.optionalString withMysql ''
# Add dependencies of the MySQL shim to the shared library
patchelf --add-needed ${zlib.out}/lib/libz.so $(readlink -f $out/lib/icinga2/libmysql_shim.so)
# Make Icinga find the MySQL shim
icinga2Bin=$out/lib/icinga2/sbin/icinga2
patchelf --set-rpath $out/lib/icinga2:$(patchelf --print-rpath $icinga2Bin) $icinga2Bin
''}
'';
vim = runCommand "vim-icinga2-${version}" { pname = "vim-icinga2"; } ''
mkdir -p $out/share/vim-plugins
cp -r "${src}/tools/syntax/vim" $out/share/vim-plugins/icinga2
'';
meta = {
description = "Open source monitoring system";
homepage = "https://www.icinga.com";
license = lib.licenses.gpl2Plus;
platforms = lib.platforms.linux;
teams = [ lib.teams.helsinki-systems ];
};
}

View File

@@ -0,0 +1,13 @@
diff --git a/config.h.cmake b/config.h.cmake
index 16fa190..152bf43 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -13,7 +13,7 @@
#cmakedefine ICINGA2_UNITY_BUILD
-#define ICINGA_CONFIGDIR "${ICINGA2_FULL_CONFIGDIR}"
+#define ICINGA_CONFIGDIR "/etc/icinga2"
#define ICINGA_DATADIR "${ICINGA2_FULL_DATADIR}"
#define ICINGA_LOGDIR "${ICINGA2_FULL_LOGDIR}"
#define ICINGA_CACHEDIR "${ICINGA2_FULL_CACHEDIR}"

View File

@@ -0,0 +1,15 @@
diff --git a/etc/initsystem/CMakeLists.txt b/etc/initsystem/CMakeLists.txt
index e702c83..c23cabb 100644
--- a/etc/initsystem/CMakeLists.txt
+++ b/etc/initsystem/CMakeLists.txt
@@ -50,10 +50,5 @@ if(NOT WIN32)
if (USE_SYSTEMD OR INSTALL_SYSTEMD_SERVICE_AND_INITSCRIPT)
configure_file(icinga2.service.cmake ${CMAKE_CURRENT_BINARY_DIR}/initsystem/icinga2.service @ONLY)
- install(
- FILES ${CMAKE_CURRENT_BINARY_DIR}/initsystem/icinga2.service
- DESTINATION ${DESTDIR}/usr/lib/systemd/system
- PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
- )
endif()
endif()

View File

@@ -0,0 +1,70 @@
diff --git a/icinga-app/CMakeLists.txt b/icinga-app/CMakeLists.txt
index 1c92d8331..e77199959 100644
--- a/icinga-app/CMakeLists.txt
+++ b/icinga-app/CMakeLists.txt
@@ -94,9 +94,3 @@ install(
TARGETS icinga-app
RUNTIME DESTINATION ${InstallPath}
)
-
-if(NOT WIN32)
- install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ICINGA2_FULL_LOGDIR}\")")
- install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ICINGA2_FULL_DATADIR}\")")
- install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ICINGA2_FULL_INITRUNDIR}\")")
-endif()
diff --git a/lib/base/CMakeLists.txt b/lib/base/CMakeLists.txt
index 986050017..39711c79e 100644
--- a/lib/base/CMakeLists.txt
+++ b/lib/base/CMakeLists.txt
@@ -154,9 +154,4 @@ set_target_properties (
FOLDER Lib
)
-if(NOT WIN32)
- install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ICINGA2_FULL_CACHEDIR}\")")
- install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ICINGA2_FULL_LOGDIR}/crash\")")
-endif()
-
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}" PARENT_SCOPE)
diff --git a/lib/perfdata/CMakeLists.txt b/lib/perfdata/CMakeLists.txt
index ab963f7..3d9d506 100644
--- a/lib/perfdata/CMakeLists.txt
+++ b/lib/perfdata/CMakeLists.txt
@@ -74,7 +74,4 @@ install_if_not_exists(
${ICINGA2_CONFIGDIR}/features-available
)
-install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ICINGA2_FULL_SPOOLDIR}/perfdata\")")
-install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ICINGA2_FULL_SPOOLDIR}/tmp\")")
-
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}" PARENT_SCOPE)
diff --git a/lib/remote/CMakeLists.txt b/lib/remote/CMakeLists.txt
index 2271abff6..fc03b5c6b 100644
--- a/lib/remote/CMakeLists.txt
+++ b/lib/remote/CMakeLists.txt
@@ -57,12 +57,3 @@ set_target_properties (
remote PROPERTIES
FOLDER Lib
)
-
-if(NOT WIN32)
- #install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ICINGA2_FULL_DATADIR}/api\")")
- install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ICINGA2_FULL_DATADIR}/api/log\")")
- install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ICINGA2_FULL_DATADIR}/api/zones\")")
- install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ICINGA2_FULL_DATADIR}/api/zones-stage\")")
- install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ICINGA2_FULL_DATADIR}/certs\")")
- install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ICINGA2_FULL_DATADIR}/certificate-requests\")")
-endif()
diff --git a/lib/compat/CMakeLists.txt b/lib/compat/CMakeLists.txt
index 1438626..d882ae2 100644
--- a/lib/compat/CMakeLists.txt
+++ b/lib/compat/CMakeLists.txt
@@ -55,8 +55,4 @@ install_if_not_exists(
${ICINGA2_CONFIGDIR}/features-available
)
-install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ICINGA2_FULL_LOGDIR}/compat/archives\")")
-install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ICINGA2_FULL_SPOOLDIR}\")")
-install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ICINGA2_FULL_INITRUNDIR}/cmd\")")
-
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}" PARENT_SCOPE)