nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 autoconf,
5 automake,
6 bash,
7 bzip2,
8 corosync,
9 dbus,
10 fetchFromGitHub,
11 glib,
12 gnutls,
13 libqb,
14 libtool,
15 libuuid,
16 libxml2,
17 libxslt,
18 pam,
19 pkg-config,
20 python3,
21 nixosTests,
22
23 # Pacemaker is compiled twice, once with forOCF = true to extract its
24 # OCF definitions for use in the ocf-resource-agents derivation, then
25 # again with forOCF = false, where the ocf-resource-agents is provided
26 # as the OCF_ROOT.
27 forOCF ? false,
28 ocf-resource-agents,
29}:
30
31stdenv.mkDerivation (finalAttrs: {
32 pname = "pacemaker";
33 version = "3.0.1";
34
35 src = fetchFromGitHub {
36 owner = "ClusterLabs";
37 repo = "pacemaker";
38 rev = "Pacemaker-${finalAttrs.version}";
39 sha256 = "sha256-23YkNzqiimLy/KjO+hxVQQ4rUhSEhn5Oc2jUJO/VRo0=";
40 };
41
42 nativeBuildInputs = [
43 autoconf
44 automake
45 libtool
46 pkg-config
47 ];
48
49 buildInputs = [
50 bash
51 bzip2
52 corosync
53 dbus.dev
54 glib
55 gnutls
56 libqb
57 libuuid
58 libxml2.dev
59 libxslt.dev
60 pam
61 python3
62 ];
63
64 preConfigure = ''
65 ./autogen.sh --prefix="$out"
66 '';
67 configureFlags = [
68 "--exec-prefix=${placeholder "out"}"
69 "--sysconfdir=/etc"
70 "--localstatedir=/var"
71 "--with-initdir=/etc/systemd/system"
72 "--with-systemdsystemunitdir=/etc/systemd/system"
73 "--with-corosync"
74 # allows Type=notify in the systemd service
75 "--enable-systemd"
76 ]
77 ++ lib.optional (!forOCF) "--with-ocfdir=${ocf-resource-agents}/usr/lib/ocf";
78
79 installFlags = [ "DESTDIR=${placeholder "out"}" ];
80
81 env.NIX_CFLAGS_COMPILE = toString (
82 lib.optionals stdenv.cc.isGNU [
83 "-Wno-error=strict-prototypes"
84 "-Wno-error=deprecated-declarations"
85 ]
86 );
87
88 enableParallelBuilding = true;
89
90 postInstall = ''
91 # pacemaker's install linking requires a weirdly nested hierarchy
92 mv $out$out/* $out
93 rm -r $out/nix
94 '';
95
96 passthru.tests = {
97 inherit (nixosTests) pacemaker;
98 };
99
100 meta = {
101 homepage = "https://clusterlabs.org/pacemaker/";
102 description = "Open source, high availability resource manager suitable for both small and large clusters";
103 license = lib.licenses.gpl2Plus;
104 platforms = lib.platforms.linux;
105 maintainers = with lib.maintainers; [
106 ryantm
107 astro
108 ];
109 };
110})