Aro Translate-C + NixOS Integration

The Zig compiler, very conveniently for us Nix users, automatically detects $NIX_CFLAGS_COMPILE and $NIX_LDFLAGS. This means that when you add a C library to your nix shell, it’s automatically picked up as a system library by @cInclude("...."). This is very cool and I like it a lot :slight_smile:

The new Aro-based Translate-C does not do this, as far as I can tell. Is this something that someone (me) could contribute? Or is this an intentional omission?

I’m opening up a discussion topic on this instead of a github issue because I’m not particularly sure where the detection should go - I see 3 viable places:

  • The bit of translate-c that runs during the build script (my favorite of the three)
  • The bit of translate-c that runs during build time
  • Arocc itself

But again I’m also not sure this patch would be accepted & so I wanted to check in first. I would also appreciate having a person to throw questions at in the process of creating a patch :sweat_smile:

1 Like

Best place is during the build script, called the configure phase, build time is the make phase.

It would do the same thing that happens when you specify custom include paths. Seems the easiest and most strait forward of the options.

Hmmm fair enough, here’s a PR Translator: use NIX_CFLAGS_COMPILE to find system headers by cursedquail · Pull Request #41 · ziglang/translate-c · GitHub

1 Like