-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshell.nix
51 lines (51 loc) · 1.41 KB
/
shell.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
let
pkgs = import <nixpkgs> {};
llvmPackages = pkgs.llvmPackages_14;
# llvmPackages.stdenv pull GNU binutils but with want llvm variant
# with mold instead of lld since it is faster.
bintoolsWithMold = llvmPackages.bintools.override {
bintools = llvmPackages.bintools.bintools.override {
lld = pkgs.mold;
};
};
clang = llvmPackages.clangUseLLVM.override {
# llvmPackages.clangUseLLVM pull gcc but it seem uneeded
gccForLibs = null;
# TODO(Et7f3): Is mold 2.0 released ?
bintools = if pkgs.mold.meta.broken
then llvmPackages.clangUseLLVM.bintools
else bintoolsWithMold;
};
clangStdenv = pkgs.overrideCC pkgs.stdenv clang;
mkShell = pkgs.mkShell.override {
stdenv = clangStdenv;
};
in
mkShell {
name = "rush1";
buildInputs = [
pkgs.include-what-you-use
pkgs.gitMinimal
pkgs.json_c
pkgs.pkg-config
];
shellHooks = ''
export MODE=DEV
switchMode(){
case "$MODE" in
DEV)
MODE=PROD;
;;
PROD)
MODE=DEV;
;;
esac
}
export LD_LIBRARY_PATH=${pkgs.json_c}/lib:${llvmPackages.libunwind}/lib
''
+ pkgs.lib.optionalString (!pkgs.mold.meta.broken) ''
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE "-fuse-ld=mold
'';
# TODO(Et7f3): Debug this
hardeningDisable = pkgs.lib.optional pkgs.targetPlatform.isDarwin "fortify";
}