-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
59 lines (52 loc) · 1.78 KB
/
flake.nix
File metadata and controls
59 lines (52 loc) · 1.78 KB
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
{
description = "Dev shell for kiou (single-broker Kafka io_uring project)";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
};
lib = pkgs.lib;
in
{
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
clang-tools
clang
gcc
cmake
gnumake
meson
ninja
pkg-config
liburing
];
CPATH = lib.makeSearchPath "include" [
pkgs.glibc.dev
pkgs.gcc
pkgs.liburing.dev
];
# Keep runtime libs focused on toolchain/libs and avoid glibc injection;
# injecting glibc here can break clangd with symbol lookup errors.
LD_LIBRARY_PATH = lib.makeLibraryPath [
pkgs.gcc.cc.lib
pkgs.liburing
];
shellHook = ''
export CC=${pkgs.gcc}/bin/gcc
export CXX=${pkgs.gcc}/bin/g++
# Use stable gcc/clang wrappers from Nix/System for system include probing.
export KIOU_CLANGD_QUERY_DRIVER="/run/current-system/sw/bin/g++,/run/current-system/sw/bin/gcc,/nix/store/*/bin/g++,/nix/store/*/bin/gcc,/nix/store/*/bin/clang++,/nix/store/*/bin/clang"
echo "kiou C/C++ dev shell ready."
echo "CC=$CC"
echo "CXX=$CXX"
echo "clangd query-driver=$KIOU_CLANGD_QUERY_DRIVER"
echo "Tip: meson setup --wipe build && ln -sf build/compile_commands.json compile_commands.json"
'';
};
});
}