diff --git a/pkgs/development/compilers/terra/default.nix b/pkgs/development/compilers/terra/default.nix index c4e697f2f1e..371009af5ff 100644 --- a/pkgs/development/compilers/terra/default.nix +++ b/pkgs/development/compilers/terra/default.nix @@ -23,6 +23,8 @@ stdenv.mkDerivation rec { outputs = [ "bin" "dev" "out" "static" ]; + patches = [ ./nix-cflags.patch ]; + postPatch = '' substituteInPlace Makefile --replace \ '-lcurses' '-lncurses' diff --git a/pkgs/development/compilers/terra/nix-cflags.patch b/pkgs/development/compilers/terra/nix-cflags.patch new file mode 100644 index 00000000000..be9b6a61088 --- /dev/null +++ b/pkgs/development/compilers/terra/nix-cflags.patch @@ -0,0 +1,19 @@ +diff --git a/src/terralib.lua b/src/terralib.lua +index 351238d..f26591b 100644 +--- a/src/terralib.lua ++++ b/src/terralib.lua +@@ -3395,6 +3395,14 @@ function terra.includecstring(code,cargs,target) + args:insert("-internal-isystem") + args:insert(path) + end ++ ++ -- NOTE(aseipp): include relevant Nix header files ++ local nix_cflags = os.getenv('NIX_CFLAGS_COMPILE') ++ if nix_cflags ~= nil then ++ for w in nix_cflags:gmatch("%S+") do ++ args:insert(w) ++ end ++ end + + if cargs then + args:insertall(cargs)