From e088d0b8a7a0458dd5d83b271ad76fefb5fe58fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dav=C3=AD=C3=B0=20Steinn=20Geirsson?= Date: Fri, 29 Aug 2025 15:28:55 +0000 Subject: [PATCH 1/3] nfs-ganesha: Add (default disabled) Ceph support CephFS and RGW FSAL, storage of recovery info in RADOS objects, and RADOS URL support. --- pkgs/by-name/nf/nfs-ganesha/package.nix | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/nf/nfs-ganesha/package.nix b/pkgs/by-name/nf/nfs-ganesha/package.nix index c3b65eb37243..a57e5daa8b38 100644 --- a/pkgs/by-name/nf/nfs-ganesha/package.nix +++ b/pkgs/by-name/nf/nfs-ganesha/package.nix @@ -16,6 +16,8 @@ flex, nfs-utils, acl, + useCeph ? false, + ceph, }: stdenv.mkDerivation rec { @@ -44,6 +46,12 @@ stdenv.mkDerivation rec { "-DUSE_ACL_MAPPING=ON" "-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON" "-DUSE_MAN_PAGE=ON" + ] + ++ lib.optionals useCeph [ + "-DUSE_RADOS_RECOV=ON" + "-DRADOS_URLS=ON" + "-DUSE_FSAL_CEPH=ON" + "-DUSE_FSAL_RGW=ON" ]; nativeBuildInputs = [ @@ -64,7 +72,8 @@ stdenv.mkDerivation rec { ntirpc liburcu nfs-utils - ]; + ] + ++ lib.optional useCeph ceph; postPatch = '' substituteInPlace src/tools/mount.9P --replace "/bin/mount" "/usr/bin/env mount" @@ -72,6 +81,12 @@ stdenv.mkDerivation rec { postFixup = '' patchelf --add-rpath $out/lib $out/bin/ganesha.nfsd + patchelf --add-rpath $out/lib $out/lib/libganesha_nfsd.so + '' + + lib.optionalString useCeph '' + patchelf --add-rpath $out/lib $out/bin/ganesha-rados-grace + patchelf --add-rpath $out/lib $out/lib/libganesha_rados_recov.so + patchelf --add-rpath $out/lib $out/lib/libganesha_rados_urls.so ''; postInstall = '' From eff9c8c99e6de28c2b414fe2986fc8371d929639 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dav=C3=AD=C3=B0=20Steinn=20Geirsson?= Date: Fri, 29 Aug 2025 20:04:13 +0000 Subject: [PATCH 2/3] nfs-ganesha: Add DBus support for metrics and management https://github.com/nfs-ganesha/nfs-ganesha/wiki/Dbusinterface --- ...allow-bypassing-dbus-pkg-config-test.patch | 44 +++++++++++++++++++ pkgs/by-name/nf/nfs-ganesha/package.nix | 19 +++++++- 2 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 pkgs/by-name/nf/nfs-ganesha/allow-bypassing-dbus-pkg-config-test.patch diff --git a/pkgs/by-name/nf/nfs-ganesha/allow-bypassing-dbus-pkg-config-test.patch b/pkgs/by-name/nf/nfs-ganesha/allow-bypassing-dbus-pkg-config-test.patch new file mode 100644 index 000000000000..0f83ba51870c --- /dev/null +++ b/pkgs/by-name/nf/nfs-ganesha/allow-bypassing-dbus-pkg-config-test.patch @@ -0,0 +1,44 @@ +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 73276dff6..94027f5cb 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -974,21 +974,27 @@ endif(USE_EFENCE) + + gopt_test(USE_DBUS) + if(USE_DBUS) +- find_package(PkgConfig) +- # pkg_check_modules doesn't fatal error on REQUIRED, so handle it ourselves +- pkg_check_modules(DBUS ${USE_DBUS_REQUIRED} dbus-1) +- if(NOT DBUS_FOUND) +- if(USE_DBUS_REQUIRED) +- message(FATAL_ERROR "Cannot find DBUS libs but requested on command line") +- else(USE_DBUS_REQUIRED) +- message(WARNING "Cannot find DBUS libs. Disabling DBUS support") +- set(USE_DBUS OFF) +- endif(USE_DBUS_REQUIRED) +- else(NOT DBUS_FOUND) ++ if(DBUS_NO_PKGCONFIG) + set(SYSTEM_LIBRARIES ${DBUS_LIBRARIES} ${SYSTEM_LIBRARIES}) + LIST(APPEND CMAKE_LIBRARY_PATH ${DBUS_LIBRARY_DIRS}) + link_directories (${DBUS_LIBRARY_DIRS}) +- endif(NOT DBUS_FOUND) ++ else(DBUS_NO_PKGCONFIG) ++ find_package(PkgConfig) ++ # pkg_check_modules doesn't fatal error on REQUIRED, so handle it ourselves ++ pkg_check_modules(DBUS ${USE_DBUS_REQUIRED} dbus-1) ++ if(NOT DBUS_FOUND) ++ if(USE_DBUS_REQUIRED) ++ message(FATAL_ERROR "Cannot find DBUS libs but requested on command line") ++ else(USE_DBUS_REQUIRED) ++ message(WARNING "Cannot find DBUS libs. Disabling DBUS support") ++ set(USE_DBUS OFF) ++ endif(USE_DBUS_REQUIRED) ++ else(NOT DBUS_FOUND) ++ set(SYSTEM_LIBRARIES ${DBUS_LIBRARIES} ${SYSTEM_LIBRARIES}) ++ LIST(APPEND CMAKE_LIBRARY_PATH ${DBUS_LIBRARY_DIRS}) ++ link_directories (${DBUS_LIBRARY_DIRS}) ++ endif(NOT DBUS_FOUND) ++ endif(DBUS_NO_PKGCONFIG) + endif(USE_DBUS) + + if(USE_CB_SIMULATOR AND NOT USE_DBUS) diff --git a/pkgs/by-name/nf/nfs-ganesha/package.nix b/pkgs/by-name/nf/nfs-ganesha/package.nix index a57e5daa8b38..afeff6439196 100644 --- a/pkgs/by-name/nf/nfs-ganesha/package.nix +++ b/pkgs/by-name/nf/nfs-ganesha/package.nix @@ -8,7 +8,6 @@ krb5, xfsprogs, jemalloc, - dbus, libcap, ntirpc, liburcu, @@ -18,6 +17,8 @@ acl, useCeph ? false, ceph, + useDbus ? true, + dbus, }: stdenv.mkDerivation rec { @@ -37,6 +38,8 @@ stdenv.mkDerivation rec { hash = "sha256-OHGmEzHu8y/TPQ70E2sicaLtNgvlf/bRq8JRs6S1tpY="; }; + patches = lib.optional useDbus ./allow-bypassing-dbus-pkg-config-test.patch; + preConfigure = "cd src"; cmakeFlags = [ @@ -52,6 +55,13 @@ stdenv.mkDerivation rec { "-DRADOS_URLS=ON" "-DUSE_FSAL_CEPH=ON" "-DUSE_FSAL_RGW=ON" + ] + ++ lib.optionals useDbus [ + "-DUSE_DBUS=ON" + "-DDBUS_NO_PKGCONFIG=ON" + "-DDBUS_LIBRARY_DIRS=${dbus.lib}/lib" + "-DDBUS_INCLUDE_DIRS=${dbus.dev}/include/dbus-1.0\\;${dbus.lib}/lib/dbus-1.0/include" + "-DDBUS_LIBRARIES=dbus-1" ]; nativeBuildInputs = [ @@ -60,7 +70,8 @@ stdenv.mkDerivation rec { bison flex sphinx - ]; + ] + ++ lib.optional useDbus dbus.dev; buildInputs = [ acl @@ -91,6 +102,10 @@ stdenv.mkDerivation rec { postInstall = '' install -Dm755 $src/src/tools/mount.9P $tools/bin/mount.9P + '' + + lib.optionalString useDbus '' + # Policy for D-Bus statistics interface + install -Dm644 $src/src/scripts/ganeshactl/org.ganesha.nfsd.conf $out/etc/dbus-1/system.d/org.ganesha.nfsd.conf ''; meta = with lib; { From 49abca3fdee3a696410cbc755d65e4601fd6b82c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dav=C3=AD=C3=B0=20Steinn=20Geirsson?= Date: Wed, 3 Sep 2025 17:30:49 +0000 Subject: [PATCH 3/3] nfs-ganesha: Coding style updates from review Co-authored-by: Markus Kowalewski --- pkgs/by-name/nf/nfs-ganesha/package.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/nf/nfs-ganesha/package.nix b/pkgs/by-name/nf/nfs-ganesha/package.nix index afeff6439196..8825d169e0da 100644 --- a/pkgs/by-name/nf/nfs-ganesha/package.nix +++ b/pkgs/by-name/nf/nfs-ganesha/package.nix @@ -59,8 +59,8 @@ stdenv.mkDerivation rec { ++ lib.optionals useDbus [ "-DUSE_DBUS=ON" "-DDBUS_NO_PKGCONFIG=ON" - "-DDBUS_LIBRARY_DIRS=${dbus.lib}/lib" - "-DDBUS_INCLUDE_DIRS=${dbus.dev}/include/dbus-1.0\\;${dbus.lib}/lib/dbus-1.0/include" + "-DDBUS_LIBRARY_DIRS=${lib.getLib dbus}/lib" + "-DDBUS_INCLUDE_DIRS=${lib.getDev dbus}/include/dbus-1.0\\;${lib.getLib dbus}/lib/dbus-1.0/include" "-DDBUS_LIBRARIES=dbus-1" ]; @@ -71,7 +71,7 @@ stdenv.mkDerivation rec { flex sphinx ] - ++ lib.optional useDbus dbus.dev; + ++ lib.optional useDbus dbus; buildInputs = [ acl