diff --git a/pkgs/by-name/ng/nghttp3/package.nix b/pkgs/by-name/ng/nghttp3/package.nix index 784e5c3ecf6a..3b9b0098765a 100644 --- a/pkgs/by-name/ng/nghttp3/package.nix +++ b/pkgs/by-name/ng/nghttp3/package.nix @@ -23,9 +23,16 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ cmake ]; - cmakeFlags = [ - (lib.cmakeBool "ENABLE_STATIC_LIB" false) - ]; + cmakeFlags = + if stdenv.hostPlatform.isStatic then + [ + (lib.cmakeBool "ENABLE_SHARED_LIB" false) + (lib.cmakeBool "ENABLE_STATIC_LIB" true) + ] + else + [ + (lib.cmakeBool "ENABLE_STATIC_LIB" false) + ]; doCheck = true; diff --git a/pkgs/development/libraries/ngtcp2/default.nix b/pkgs/development/libraries/ngtcp2/default.nix index bf595f473050..9de9314dc37d 100644 --- a/pkgs/development/libraries/ngtcp2/default.nix +++ b/pkgs/development/libraries/ngtcp2/default.nix @@ -36,9 +36,19 @@ stdenv.mkDerivation (finalAttrs: { ] ++ lib.optional withJemalloc jemalloc; - cmakeFlags = [ - (lib.cmakeBool "ENABLE_STATIC_LIB" false) - ]; + cmakeFlags = + if stdenv.hostPlatform.isStatic then + [ + # The examples try to link against `ngtcp2_crypto_ossl` and `ngtcp2` libraries. + # This works in the dynamic case where the targets have the same name, but not here where they're suffixed with `_static`. + (lib.cmakeBool "ENABLE_LIB_ONLY" true) + (lib.cmakeBool "ENABLE_SHARED_LIB" false) + (lib.cmakeBool "ENABLE_STATIC_LIB" true) + ] + else + [ + (lib.cmakeBool "ENABLE_STATIC_LIB" false) + ]; doCheck = true;