-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathflake.nix
60 lines (54 loc) · 1.8 KB
/
flake.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
52
53
54
55
56
57
58
59
60
{
inputs = {
nixpkgs.url = "nixpkgs";
flake-utils.url = "flake-utils";
};
outputs = { nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
};
inherit (pkgs.lib.strings) concatStringsSep makeIncludePath makeLibraryPath;
go = pkgs.go_1_24;
buildGoModule = pkgs.buildGo124Module;
gcc = pkgs.gcc-unwrapped;
libc = gcc.libc_dev.out;
gccVersion = "14.2.1"; # name used in directory, which sadly != gcc.version.
cIncludePath = [
"${gcc}/lib/gcc/${pkgs.targetPlatform.config}/${gccVersion}/include"
"${gcc}/include"
"${gcc}/lib/gcc/${pkgs.targetPlatform.config}/${gccVersion}/include-fixed"
"${libc.dev}/include"
];
cplusIncludePath = [
"${gcc}/include/c++/${gcc.version}/"
"${gcc}/include/c++/${gcc.version}//${pkgs.targetPlatform.config}"
"${gcc}/include/c++/${gcc.version}//backward"
] ++ cIncludePath;
in
{
devShells.default = pkgs.mkShellNoCC {
packages = [
gcc
(pkgs.delve.override {
inherit buildGoModule;
})
libc.bin
go
pkgs.gotools # stringer, etc.
(pkgs.gopls.override {
inherit buildGoModule;
})
];
shellHook = ''
export C_INCLUDE_PATH='${concatStringsSep ":" cIncludePath}'
export CPLUS_INCLUDE_PATH='${concatStringsSep ":" cplusIncludePath}'
export LIBRARY_PATH='${makeLibraryPath [ gcc libc ]}'
export ZB_BOOTSTRAP_SYSTEM_HEADERS='${makeIncludePath [ libc.dev ]}'
'';
hardeningDisable = [ "fortify" ];
};
}
);
}