corosync-qnetd package and service module working

This commit is contained in:
Kabbone 2025-09-09 22:45:23 +02:00
parent 9bf0ad396f
commit 583dd62731
Signed by: Kabbone
SSH Key Fingerprint: SHA256:A5zPB5I6u5V78V51c362BBdCwhDhfDUVbt7NfKdjWBY
3 changed files with 113 additions and 35 deletions

View File

@ -0,0 +1,65 @@
{
lib,
config,
pkgs,
pkgs-kabbone,
...
}:
let
cfg = config.services.corosync-qnetd;
in
{
# interface
options.services.corosync-qnetd = {
enable = lib.mkEnableOption "corosync-qnetd";
package = lib.mkPackageOption pkgs-kabbone "corosync-qdevice" { };
extraOptions = lib.mkOption {
type = with lib.types; listOf str;
default = [ ];
description = "Additional options with which to start corosync-qnetd.";
};
};
# implementation
# implementation
config = lib.mkIf cfg.enable {
environment.systemPackages = [ cfg.package ];
# environment.etc."corosync/corosync-qnetd.conf".text = ''
# totem {
# version: 2
# secauth: on
# cluster_name: ${cfg.clusterName}
# transport: knet
# }
# logging {
# to_syslog: yes
# }
# '';
systemd.packages = [ cfg.package ];
systemd.services.corosync-qnetd = {
serviceConfig = {
User = "coroqnetd";
StateDirectory = "corosync-qnetd";
StateDirectoryMode = "0700";
};
};
environment.etc."sysconfig/corosync-qnetd".text = lib.optionalString (cfg.extraOptions != [ ]) ''
COROSYNC-QNETD_OPTIONS="${lib.escapeShellArgs cfg.extraOptions}"
'';
};
meta = {
#buildDocsInSandbox = false;
#doc = ./mautrix-whatsapp.md;
maintainers = with lib.maintainers; [
kabbone
];
};
}

View File

@ -1,40 +1,49 @@
#{ stdenv, fetchgit, corosync, nss } : {
{ pkgs ? import <nixpkgs> {} }: lib,
pkgs.stdenv.mkDerivation rec { pkgs,
name = "corosync-qdevice"; stdenv
version = "3.0.3"; } :
src = pkgs.fetchFromGitHub { stdenv.mkDerivation rec {
owner = "corosync"; pname = "corosync-qdevice";
repo = "corosync-qdevice"; version = "3.0.3";
rev = "v${version}"; src = pkgs.fetchFromGitHub {
sha256 = "sha256-9FyLhcGHNW73Xao7JiODzgyDKIynEAHJUlNppX+nPfw="; owner = "corosync";
}; repo = "corosync-qdevice";
enableParallelBuilding = true; rev = "v${version}";
sha256 = "sha256-9FyLhcGHNW73Xao7JiODzgyDKIynEAHJUlNppX+nPfw=";
};
enableParallelBuilding = true;
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [
nss autoconf
autoconf automake
automake libtool
libtool pkg-config
pkg-config libqb
libqb systemd
corosync ];
systemd
];
# buildInputs = with pkgs; [ buildInputs = with pkgs; [
# corosync corosync
# ]; nss
];
configurePhase = '' configurePhase = ''
./autogen.sh ./autogen.sh
./configure \ ./configure \
--prefix=$out \ --prefix=$out \
--enable-systemd \ --enable-systemd \
--disable-upstart --disable-upstart
''; '';
buildPhase = '' buildPhase = ''
make make
''; '';
meta = {
description = "daemon for quorum on clusters";
homepage = "https://github.com/corosync/corosync-qdevice";
platforms = lib.platforms.linux;
license = lib.licenses.gpl3;
};
} }

4
packages/default.nix Normal file
View File

@ -0,0 +1,4 @@
{ pkgs, ... }:
{
corosync-qdevice = pkgs.callPackage ./corosync-qdevice.nix {};
}