I’m trying to build a simple gtk2 application with nix. I have as my shell.nix
the following:
with import <nixpkgs> { };
mkShell {
nativeBuildInputs = [ pkg-config ];
buildInputs = [ gtk2 glib gtk2-x11 ccls ];
}
and the helloworld.c
is as follows:
#include <gtk/gtk.h>
int main (int argc, char *argv[]) {
GtkWidget *window;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Hello World");
gtk_widget_show (window);
gtk_main ();
return 0;
}
To compile this I’m doing gcc $(pkg-config --cflags --libs gtk+-2.0) helloworld.c
. What’s the more nix-y way to build this? Ideally it’s something that would allow the language server ccls
to work in my editor as well.