2021-02-24 17:36:49 +00:00
|
|
|
# This combines together OCF definitions from other derivations.
|
|
|
|
# https://github.com/ClusterLabs/resource-agents/blob/master/doc/dev-guides/ra-dev-guide.asc
|
2021-11-30 20:39:11 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, runCommand
|
|
|
|
, lndir
|
|
|
|
, fetchFromGitHub
|
2024-02-07 19:36:22 +00:00
|
|
|
, fetchpatch
|
2021-11-30 20:39:11 +00:00
|
|
|
, autoreconfHook
|
|
|
|
, pkg-config
|
|
|
|
, python3
|
|
|
|
, glib
|
|
|
|
, drbd
|
2021-02-24 17:36:49 +00:00
|
|
|
, pacemaker
|
2021-11-30 20:39:11 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
drbdForOCF = drbd.override {
|
|
|
|
forOCF = true;
|
|
|
|
};
|
2021-02-24 17:36:49 +00:00
|
|
|
pacemakerForOCF = pacemaker.override {
|
|
|
|
forOCF = true;
|
|
|
|
};
|
2021-11-30 20:39:11 +00:00
|
|
|
|
|
|
|
resource-agentsForOCF = stdenv.mkDerivation rec {
|
|
|
|
pname = "resource-agents";
|
|
|
|
version = "4.10.0";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ClusterLabs";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "0haryi3yrszdfpqnkfnppxj1yiy6ipah6m80snvayc7v0ss0wnir";
|
|
|
|
};
|
|
|
|
|
2024-02-07 19:36:22 +00:00
|
|
|
patches = [
|
|
|
|
# autoconf-2.72 upstream fix:
|
|
|
|
# https://github.com/ClusterLabs/resource-agents/pull/1908
|
|
|
|
(fetchpatch {
|
|
|
|
name = "autoconf-2.72.patch";
|
|
|
|
url = "https://github.com/ClusterLabs/resource-agents/commit/bac658711a61fd704e792e2a0a45a2137213c442.patch";
|
|
|
|
hash = "sha256-Xq7W8pMRmFZmkqb2430bY5zdmVTrUrob6GwGiN6/bKY=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2021-11-30 20:39:11 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
autoreconfHook
|
|
|
|
pkg-config
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
glib
|
|
|
|
python3
|
|
|
|
];
|
|
|
|
|
2023-02-20 15:36:06 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = toString (lib.optionals (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "12") [
|
2023-02-05 13:56:47 +00:00
|
|
|
# Needed with GCC 12 but breaks on darwin (with clang) or older gcc
|
|
|
|
"-Wno-error=maybe-uninitialized"
|
2023-02-20 15:36:06 +00:00
|
|
|
]);
|
2023-02-05 13:56:47 +00:00
|
|
|
|
2021-11-30 20:39:11 +00:00
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://github.com/ClusterLabs/resource-agents";
|
|
|
|
description = "Combined repository of OCF agents from the RHCS and Linux-HA projects";
|
|
|
|
license = licenses.gpl2Plus;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = with maintainers; [ ryantm astro ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
# This combines together OCF definitions from other derivations.
|
|
|
|
# https://github.com/ClusterLabs/resource-agents/blob/master/doc/dev-guides/ra-dev-guide.asc
|
2024-02-07 10:31:59 +00:00
|
|
|
runCommand "ocf-resource-agents" {
|
|
|
|
# Fix derivation location so things like
|
|
|
|
# $ nix edit -f. ocf-resource-agents
|
|
|
|
# just work.
|
|
|
|
pos = builtins.unsafeGetAttrPos "version" resource-agentsForOCF;
|
2024-02-07 16:33:14 +00:00
|
|
|
|
|
|
|
# Useful to build and undate inputs individually:
|
|
|
|
passthru.inputs = {
|
|
|
|
inherit resource-agentsForOCF drbdForOCF pacemakerForOCF;
|
|
|
|
};
|
2024-02-07 10:31:59 +00:00
|
|
|
} ''
|
2021-11-30 20:39:11 +00:00
|
|
|
mkdir -p $out/usr/lib/ocf
|
|
|
|
${lndir}/bin/lndir -silent "${resource-agentsForOCF}/lib/ocf/" $out/usr/lib/ocf
|
|
|
|
${lndir}/bin/lndir -silent "${drbdForOCF}/usr/lib/ocf/" $out/usr/lib/ocf
|
2021-02-24 17:36:49 +00:00
|
|
|
${lndir}/bin/lndir -silent "${pacemakerForOCF}/usr/lib/ocf/" $out/usr/lib/ocf
|
2021-11-30 20:39:11 +00:00
|
|
|
''
|