Curl Library Installation

  1. Click Files ⋮ > Show hidden files
  2. Add to the replit.nix file, before the closing }:
  env = {
    C_INCLUDE_PATH = "${}/include/libxml2";
  1. Run in shell:
sed -i '/^override C/s/$/ -lxml2/' Makefile
pkill ccls

How did I get the code for #2?

Do read this so you can hopefully add packages in future by yourself
First, I search for the package on
I add .dev at the end because this is what you do when

  • you want a header
  • and you see a dev output in the search result on

Adding to the deps as with curl doesn’t work: this library is packaged weirdly so the actual library that you have to include is within a subfolder of /include (/include/libxml2).
How did I know that?
I want to inspect the package’s contents. First I add to replit.nix:

env = {
  XML = "${}/include";

Our include starts with libxml/, so we want to be able to include a libxml folder, so in Shell, I run:

shopt -s globstar
echo **/libxml/

Output: libxml2/libxml. So, when I add libxml/ to the $C_INCLUDE_PATH, I must add /include/libxml2. I change the env section to:

    C_INCLUDE_PATH = "${}/include/libxml2";

When I want to add another library that’s packaged weirdly and can’t be added through deps, I have to add a : before the next path, e.g.

     C_INCLUDE_PATH = "${}/include/libxml2:${}/include/SDL2";

You can usually use builtins, string functions and with to simplify this when it becomes too long and repetitive. A good example.