Skip to content

Commit d9fc91c

Browse files
authored
Merge pull request #263 from typelevel/sysroot
2 parents a271889 + 62907a6 commit d9fc91c

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

modules/native.nix

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,19 @@
33
with lib;
44
let
55
cfg = config.typelevelShell.native;
6+
7+
clang = if pkgs.stdenv.isLinux then
8+
pkgs.runCommand "sysrooted-clang" { } ''
9+
mkdir -p $out/bin
10+
for bin in clang clang++; do
11+
cat > $out/bin/$bin <<EOF
12+
#!${pkgs.runtimeShell}
13+
exec "${pkgs.clang}"/bin/$bin --sysroot="${pkgs.glibc.dev}" "\$@"
14+
EOF
15+
chmod +x $out/bin/$bin
16+
done
17+
''
18+
else pkgs.clang;
619
in
720
{
821
options.typelevelShell.native = {
@@ -17,7 +30,7 @@ in
1730

1831
config = mkIf cfg.enable {
1932
devshell.packages = [
20-
pkgs.clang
33+
clang
2134
pkgs.llvmPackages.libcxx
2235
] ++ flatten (map (e: [ (getDev e) (getLib e) ]) cfg.libraries);
2336

@@ -30,10 +43,6 @@ in
3043
name = "C_INCLUDE_PATH";
3144
prefix = "$DEVSHELL_DIR/include";
3245
}
33-
{
34-
name = "LLVM_BIN";
35-
value = "${pkgs.clang}/bin";
36-
}
3746
];
3847
};
3948
}

0 commit comments

Comments
 (0)