-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
107 lines (106 loc) · 3.21 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
pre-commit-hooks.url = "github:cachix/git-hooks.nix";
# dream2nix.url = "github:nix-community/dream2nix";
nixd.url = "github:nix-community/nixd";
rustacean.url = "github:mrcjkb/rustaceanvim";
};
outputs =
inputs@{
self,
flake-parts,
...
}:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"x86_64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
perSystem =
{
config,
self',
inputs',
pkgs,
system,
...
}:
{
formatter = pkgs.nixfmt-rfc-style;
checks = {
pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
nixfmt-rfc-style.enable = true;
rustfmt.enable = true;
cargo-check.enable = true;
clippy.enable = true;
clang-tidy = {
enable = true;
args = [
"--quiet"
"-p=build"
];
};
};
};
};
devShells = {
rustShell = pkgs.mkShell {
packages = with pkgs; [
self'.checks.pre-commit-check.enabledPackages
inputs'.rustacean.packages.codelldb
graphviz
cargo
rustc # needed?
rust-analyzer
rustfmt
];
inherit (self'.checks.pre-commit-check) shellHook;
};
cppShell = pkgs.mkShell {
stdenv = pkgs.clangdStdenv;
shellHook = # bash
''
${self'.checks.pre-commit-check.shellHook}
export CPLUS_INCLUDE_PATH=$(pwd)/include/
export LIBCXX_INCLUDE_PATH=${pkgs.libcxx.dev}/include/c++/v1
export LIBCXX_LIB_PATH=${pkgs.libcxx.out}/lib
export CC=${pkgs.clang}/bin/clang
export CXX=${pkgs.clang}/bin/clang++
export CXXFLAGS="-stdlib=libc++ -I${pkgs.libcxx}/include/c++/v1"
export LDFLAGS="-L${pkgs.libcxx}/lib -lc++ -lc++abi"
export CODELLDB_PATH=${inputs'.rustacean.packages.codelldb}/bin/codelldb
export MY_INCLUDE_PATH=$(pwd)/include
'';
packages = with pkgs; [
inputs'.rustacean.packages.codelldb
self'.checks.pre-commit-check.enabledPackages
# inputs'.nixd.packages.nixd
#cmake
cmake
cmake-lint
cmake-language-server
cmake-format
clang-tools
valgrind
libcxx
clang
codespell
cppcheck
cpplint
doxygen
gtest
lcov
gdb
vcpkg
vcpkg-tool
];
};
};
};
};
}