diff --git a/pkgs/development/libraries/libevent/default.nix b/pkgs/development/libraries/libevent/default.nix index 983395f33b4b..167371e287c0 100644 --- a/pkgs/development/libraries/libevent/default.nix +++ b/pkgs/development/libraries/libevent/default.nix @@ -2,6 +2,8 @@ , updateAutotoolsGnuConfigScriptsHook , sslSupport ? true, openssl , fetchpatch + +, static ? stdenv.hostPlatform.isStatic }: stdenv.mkDerivation rec { @@ -21,7 +23,10 @@ stdenv.mkDerivation rec { }) ]; - configureFlags = lib.optional (!sslSupport) "--disable-openssl"; + configureFlags = lib.flatten [ + (lib.optional (!sslSupport) "--disable-openssl") + (lib.optionals static ["--disable-shared" "--with-pic"]) + ]; preConfigure = lib.optionalString (lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11") '' MACOSX_DEPLOYMENT_TARGET=10.16 diff --git a/pkgs/development/libraries/yaml-cpp/default.nix b/pkgs/development/libraries/yaml-cpp/default.nix index 3ee2dcf77041..f87849b58c72 100644 --- a/pkgs/development/libraries/yaml-cpp/default.nix +++ b/pkgs/development/libraries/yaml-cpp/default.nix @@ -3,6 +3,7 @@ , fetchFromGitHub , gitUpdater , cmake +, static ? stdenv.hostPlatform.isStatic }: stdenv.mkDerivation rec { @@ -24,7 +25,7 @@ stdenv.mkDerivation rec { cmakeFlags = [ "-DYAML_CPP_BUILD_TOOLS=false" - "-DYAML_BUILD_SHARED_LIBS=${lib.boolToString (!stdenv.hostPlatform.isStatic)}" + (lib.cmakeBool "YAML_BUILD_SHARED_LIBS" (!static)) "-DINSTALL_GTEST=false" ]; diff --git a/pkgs/os-specific/linux/dcgm/default.nix b/pkgs/os-specific/linux/dcgm/default.nix index 5e03e19bf26d..7573cb37ec22 100644 --- a/pkgs/os-specific/linux/dcgm/default.nix +++ b/pkgs/os-specific/linux/dcgm/default.nix @@ -16,18 +16,10 @@ , symlinkJoin , tclap_1_4 , yaml-cpp + +, static ? gcc11Stdenv.hostPlatform.isStatic }: let - # Flags copied from DCGM's libevent build script - libevent-nossl = libevent.override { sslSupport = false; }; - libevent-nossl-static = libevent-nossl.overrideAttrs (super: { - CFLAGS = "-Wno-cast-function-type -Wno-implicit-fallthrough -fPIC"; - CXXFLAGS = "-Wno-cast-function-type -Wno-implicit-fallthrough -fPIC"; - configureFlags = super.configureFlags ++ [ "--disable-shared" "--with-pic" ]; - }); - - jsoncpp-static = jsoncpp.override { enableStatic = true; }; - # DCGM depends on 3 different versions of CUDA at the same time. # The runtime closure, thankfully, is quite small because most things # are statically linked. @@ -86,13 +78,13 @@ let # C.f. https://github.com/NVIDIA/DCGM/blob/7e1012302679e4bb7496483b32dcffb56e528c92/dcgmbuild/build.sh#L22 in gcc11Stdenv.mkDerivation rec { pname = "dcgm"; - version = "3.2.5"; # N.B: If you change this, be sure prometheus-dcgm-exporter supports this version. + version = "3.3.5"; # N.B: If you change this, be sure prometheus-dcgm-exporter supports this version. src = fetchFromGitHub { owner = "NVIDIA"; repo = "DCGM"; rev = "refs/tags/v${version}"; - hash = "sha256-iMyYOr3dSpdRV2S/TlB/tEOAWYhK09373ZRbd5vzogQ="; + hash = "sha256-n/uWvgvxAGfr1X51XgtHfFGDOO5AMBSV5UWQQpsylpg="; }; # Add our paths to the CUDA paths so FindCuda.cmake can find them. @@ -117,14 +109,18 @@ in gcc11Stdenv.mkDerivation rec { ]; buildInputs = [ - plog.dev # header-only - tclap_1_4 # header-only - + # Header-only catch2 - fmt_9 - jsoncpp-static - libevent-nossl-static - yaml-cpp + plog.dev + tclap_1_4 + + # Dependencies that can be either static or dynamic. + (fmt_9.override { enableShared = !static; }) # DCGM's build uses the static outputs regardless of enableShared + (yaml-cpp.override { inherit static; stdenv = gcc11Stdenv; }) + + # TODO: Dependencies that DCGM's CMake hard-codes to be static-only. + (jsoncpp.override { enableStatic = true; }) + (libevent.override { sslSupport = false; static = true; }) ]; disallowedReferences = lib.concatMap (x: x.pkgSet) cudaPackageSetByVersion; diff --git a/pkgs/servers/monitoring/prometheus/dcgm-exporter/default.nix b/pkgs/servers/monitoring/prometheus/dcgm-exporter/default.nix index f71cd1776bd4..05b210ac2efe 100644 --- a/pkgs/servers/monitoring/prometheus/dcgm-exporter/default.nix +++ b/pkgs/servers/monitoring/prometheus/dcgm-exporter/default.nix @@ -3,31 +3,19 @@ , fetchFromGitHub , autoAddDriverRunpath , dcgm -, linuxPackages }: buildGoModule rec { pname = "dcgm-exporter"; # The first portion of this version string corresponds to a compatible DCGM # version. - version = "3.2.5-3.1.7"; # N.B: If you change this, update dcgm as well to the matching version. + version = "3.3.5-3.4.0"; # N.B: If you change this, update dcgm as well to the matching version. src = fetchFromGitHub { owner = "NVIDIA"; repo = pname; rev = "refs/tags/${version}"; - hash = "sha256-+Hviq+iu1LBcy2VwmCX5xOq1I/zevfydesVlrVorGOI="; - }; - - # Upgrade to go 1.17 during the vendoring FOD build because it fails otherwise. - overrideModAttrs = _: { - preBuild = '' - substituteInPlace go.mod --replace 'go 1.16' 'go 1.17' - go mod tidy - ''; - postInstall = '' - cp go.mod "$out/go.mod" - ''; + hash = "sha256-IOVPEK+9ogBZJYns2pTyJwHUBMN8JqG1THTJPvpCwdo="; }; CGO_LDFLAGS = "-ldcgm"; @@ -40,12 +28,7 @@ buildGoModule rec { # symbols are available on startup. hardeningDisable = [ "bindnow" ]; - # Copy the modified go.mod we got from the vendoring process. - preBuild = '' - cp vendor/go.mod go.mod - ''; - - vendorHash = "sha256-Fjvx15e/psxoqoS6c6GhiQfe7g2aI40EmPR26xLhrzg="; + vendorHash = "sha256-urKa0O8QZnM8cWjPcGVhoAWhx6fCdMmhRX0JOriRaig="; nativeBuildInputs = [ autoAddDriverRunpath