nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchurl,
5 fetchpatch2,
6 makeWrapper,
7 pkg-config,
8 kronosnet,
9 nss,
10 nspr,
11 libqb,
12 systemd,
13 dbus,
14 rdma-core,
15 libstatgrab,
16 net-snmp,
17 enableDbus ? false,
18 enableInfiniBandRdma ? false,
19 enableMonitoring ? false,
20 enableSnmp ? false,
21 nixosTests,
22}:
23
24let
25 inherit (lib) optional;
26in
27stdenv.mkDerivation rec {
28 pname = "corosync";
29 version = "3.1.9";
30
31 src = fetchurl {
32 url = "http://build.clusterlabs.org/corosync/releases/${pname}-${version}.tar.gz";
33 sha256 = "sha256-IDNUu93uGpezxQoHbq6JxjX0Bt1nTMrvyUu5CSrNlTU=";
34 };
35
36 patches = [
37 (fetchpatch2 {
38 name = "CVE-2025-30472.patch";
39 url = "https://github.com/corosync/corosync/commit/7839990f9cdf34e55435ed90109e82709032466a.patch??full_index=1";
40 hash = "sha256-EgGTfOM9chjLnb1QWNGp6IQQKQGdetNkztdddXlN/uo=";
41 })
42 ];
43
44 nativeBuildInputs = [
45 makeWrapper
46 pkg-config
47 ];
48
49 buildInputs = [
50 kronosnet
51 nss
52 nspr
53 libqb
54 systemd.dev
55 ]
56 ++ optional enableDbus dbus
57 ++ optional enableInfiniBandRdma rdma-core
58 ++ optional enableMonitoring libstatgrab
59 ++ optional enableSnmp net-snmp;
60
61 configureFlags = [
62 "--sysconfdir=/etc"
63 "--localstatedir=/var"
64 "--with-logdir=/var/log/corosync"
65 "--enable-watchdog"
66 "--enable-qdevices"
67 # allows Type=notify in the systemd service
68 "--enable-systemd"
69 ]
70 ++ optional enableDbus "--enable-dbus"
71 ++ optional enableInfiniBandRdma "--enable-rdma"
72 ++ optional enableMonitoring "--enable-monitoring"
73 ++ optional enableSnmp "--enable-snmp";
74
75 installFlags = [
76 "sysconfdir=$(out)/etc"
77 "localstatedir=$(out)/var"
78 "COROSYSCONFDIR=$(out)/etc/corosync"
79 "INITDDIR=$(out)/etc/init.d"
80 "LOGROTATEDIR=$(out)/etc/logrotate.d"
81 ];
82
83 enableParallelBuilding = true;
84
85 preConfigure = lib.optionalString enableInfiniBandRdma ''
86 # configure looks for the pkg-config files
87 # of librdmacm and libibverbs
88 # Howver, rmda-core does not provide a pkg-config file
89 # We give the flags manually here:
90 export rdmacm_LIBS=-lrdmacm
91 export rdmacm_CFLAGS=" "
92 export ibverbs_LIBS=-libverbs
93 export ibverbs_CFLAGS=" "
94 '';
95
96 postInstall = ''
97 wrapProgram $out/bin/corosync-blackbox \
98 --prefix PATH ":" "$out/sbin:${libqb}/sbin"
99 '';
100
101 passthru.tests = {
102 inherit (nixosTests) pacemaker;
103 };
104
105 meta = {
106 homepage = "https://corosync.org/";
107 description = "Group Communication System with features for implementing high availability within applications";
108 license = lib.licenses.bsd3;
109 platforms = lib.platforms.linux;
110 maintainers = with lib.maintainers; [
111 montag451
112 ryantm
113 ];
114 };
115}