Specify include directories via environment variable
This commit is contained in:
parent
358b55c6e1
commit
40f62bf808
@ -23,6 +23,10 @@
|
|||||||
targets = [ "x86_64-unknown-linux-gnu" ];
|
targets = [ "x86_64-unknown-linux-gnu" ];
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
addLibcIncludeDir =
|
||||||
|
''
|
||||||
|
export C_INCLUDE_PATH="${pkgs.stdenv.cc.libc.dev}/include''${C_INCLUDE_PATH:+:$C_INCLUDE_PATH}"
|
||||||
|
'';
|
||||||
haskell = (import inputs.nix-haskell { inherit system inputs; } {
|
haskell = (import inputs.nix-haskell { inherit system inputs; } {
|
||||||
name = "garnet";
|
name = "garnet";
|
||||||
src = ./.;
|
src = ./.;
|
||||||
@ -44,6 +48,7 @@
|
|||||||
libs = [ pkgs.llvmPackages.libclang ];
|
libs = [ pkgs.llvmPackages.libclang ];
|
||||||
};
|
};
|
||||||
packages.garnet.components.library = {
|
packages.garnet.components.library = {
|
||||||
|
preBuild = addLibcIncludeDir;
|
||||||
preConfigure = ''
|
preConfigure = ''
|
||||||
mkdir -p rust/target/debug
|
mkdir -p rust/target/debug
|
||||||
ln -s ${garnet-rs}/include/garnet_rs.h rust/target/debug/garnet_rs.h
|
ln -s ${garnet-rs}/include/garnet_rs.h rust/target/debug/garnet_rs.h
|
||||||
@ -70,6 +75,7 @@
|
|||||||
};
|
};
|
||||||
withHoogle = false;
|
withHoogle = false;
|
||||||
withHaddock = true;
|
withHaddock = true;
|
||||||
|
shellHook = addLibcIncludeDir;
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
garnet-rs = crane.buildPackage {
|
garnet-rs = crane.buildPackage {
|
||||||
|
|||||||
@ -30,17 +30,9 @@ import Language.Haskell.TH
|
|||||||
import System.Process
|
import System.Process
|
||||||
|
|
||||||
do
|
do
|
||||||
systemDirs <- -- TODO bit of a hack
|
|
||||||
map (Dir . T.unpack . T.strip)
|
|
||||||
. concatMap (takeWhile (maybe False ((== ' ') . fst) . T.uncons) . dropWhile T.null . T.lines)
|
|
||||||
. drop 1
|
|
||||||
. T.splitOn "search starts here:"
|
|
||||||
. T.pack
|
|
||||||
. thd3
|
|
||||||
<$> runIO (readProcessWithExitCode "cpp" ["-v"] "")
|
|
||||||
withHsBindgen
|
withHsBindgen
|
||||||
def
|
def
|
||||||
{ clang = def{extraIncludeDirs = Pkg "rust/target/debug" : systemDirs}
|
{ clang = def{extraIncludeDirs = [Pkg "rust/target/debug"]}
|
||||||
, fieldNamingStrategy = OmitFieldPrefixes
|
, fieldNamingStrategy = OmitFieldPrefixes
|
||||||
}
|
}
|
||||||
def
|
def
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user