-
-
Notifications
You must be signed in to change notification settings - Fork 15.4k
Adding kafkacat #29792
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding kafkacat #29792
Conversation
|
||
# NIX_CFLAGS_COMPILE = "-Wno-error=strict-overflow"; | ||
|
||
# configureFlags = stdenv.lib.optionals stdenv.isDarwin [ "--disable-ssl" ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is about the commented-out code?
configureFlags = "--includedir=${rdkafka}/include/librdkafka"; | ||
|
||
meta = with stdenv.lib; { | ||
description = "kafkacat - generic non-JVM producer and consumer for Apache Kafka"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description should not start with the package name.
configureFlags = "--includedir=${rdkafka}/include/librdkafka"; | ||
|
||
meta = with stdenv.lib; { | ||
description = "generic non-JVM producer and consumer for Apache Kafka"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also capitalize generic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please format commit messages according to the manual: https://nixos.org/nixpkgs/manual/#chap-submitting-changes
@@ -0,0 +1,25 @@ | |||
{ stdenv, fetchFromGitHub, zlib, perl, pkgconfig, rdkafka, yajl }: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perl is not needed.
sha256 = "1fgs04rclgfwri6vd9lj0mw545nmscav9p6kh7r28k5ap2g0gak5"; | ||
}; | ||
|
||
buildInputs = [ zlib perl pkgconfig rdkafka yajl ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perl is not needed. pkgconfig should go to nativeBuildInputs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why nativeBuildInputs
? I've never clearly understood the distinction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://nixos.org/nixpkgs/manual/#ssec-stdenv-attributes see nativeBuildInputs
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is important for cross-compiling, where you have dependencies like a compiler build for the current running architectures and libraries which are compiled for the target architecture.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would I have figured out that pkgconfig should go in nativeBuildInputs?
Candidly, I started by copying the rdkafa expression, which is why perl is in there and pkgconfig is a regulart buildInput
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All programs that run during the build are nativeBuildInputs
, and basically all libraries are buildInputs
. pkgconfig
is a program.
Until recently pkgconfig
was explicitly automatically promoted from buildInputs
into nativeBuildInputs
so there was no practical difference. Since #29584 it is no longer the case, and packages with pkgconfig
in buildInputs
are broken for cross compilation.
|
||
buildInputs = [ zlib perl pkgconfig rdkafka yajl ]; | ||
|
||
configureFlags = "--includedir=${rdkafka}/include/librdkafka"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, why did I need to add the rdkafka include dir, but yajl's gets added automatically? I can't see a salient difference in the respective expressions (e.g. multiple outputs)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You did not need this; I've removed this line.
Both ${rdkafka}/include
and ${yajl}/include
are made available for the build. Since kafkacat
uses #include <librdkafka/rdkafka.h>
, this is enough. However, if kafkacat
used #include <rdkafka.h>
instead, ${rdkafka}/include/librdkafka
wouldn't be available by default and you'd have to help kafkacat
find that header with --includedir=${rdkafka}/include/librdkafka
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you tested without? I added this line because it didn't build initially - errors related to an undefined type, and adding this fixed it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But: I don't know why it would work or not, so grain of salt.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Certainly I've built it. If this include were necessary, the error would have looked like this:
In file included from kafkacat.c:50:0:
kafkacat.h:35:21: fatal error: rdkafka.h: No such file or directory
#include <rdkafka.h>
^
compilation terminated.
make: *** [mklove/Makefile.base:77: kafkacat.o] Error 1
Thank you! I've cleaned it up a bit and merged. |
No description provided.