Skip to content

Commit 585d992

Browse files
feat: add flake for cpp development
1 parent 0b320c0 commit 585d992

File tree

2 files changed

+113
-0
lines changed

2 files changed

+113
-0
lines changed

flake.lock

Lines changed: 60 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
description = "A minimal C++ development environment using flake-utils";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs";
6+
flake-utils.url = "github:numtide/flake-utils";
7+
};
8+
9+
outputs =
10+
{
11+
self,
12+
nixpkgs,
13+
flake-utils,
14+
}:
15+
flake-utils.lib.eachDefaultSystem (
16+
system:
17+
let
18+
pkgs = import nixpkgs { inherit system; };
19+
20+
# Common build inputs for both shells
21+
commonBuildInputs = with pkgs; [
22+
gcc
23+
cmake
24+
pkg-config
25+
];
26+
27+
in
28+
{
29+
devShells = {
30+
default = pkgs.mkShell {
31+
buildInputs = commonBuildInputs;
32+
shellHook = ''
33+
echo "Welcome to the C++ development environment!"
34+
'';
35+
};
36+
37+
lsp = pkgs.mkShell {
38+
buildInputs =
39+
with pkgs;
40+
[
41+
cmake-language-server
42+
clang-tools
43+
]
44+
++ commonBuildInputs;
45+
shellHook = ''
46+
export CMAKE_EXPORT_COMPILE_COMMANDS=ON
47+
echo "Welcome to the C++ development environment with LSP tools!"
48+
'';
49+
};
50+
};
51+
}
52+
);
53+
}

0 commit comments

Comments
 (0)