Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
85 lines (77 loc) · 2.44 KB
/
Copy pathflake.nix
File metadata and controls
85 lines (77 loc) · 2.44 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
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
# Nix flake for wold9168/cpp-template
# Before building with this Nix Flake file,
# please review and modify all sections marked as "Changeme".
{
description = "Nix flake for wold9168/cpp-template"; # Changeme
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
# ═══════════════════════════════════════════════════════════
# Third-party C/C++ libs without Nix support — fetch via flake = false
# Uncomment and wire into preConfigure below
# ═══════════════════════════════════════════════════════════
# ── Example: CMake-based library (not in nixpkgs) ──
# example-cmake-lib = {
# url = "github:user/cmake-library";
# flake = false;
# };
# ── Example: Makefile/Automake-based library (not in nixpkgs) ──
# example-makefile-lib = {
# url = "github:user/makefile-library";
# flake = false;
# };
};
outputs =
{
self,
nixpkgs,
...
}@inputs:
let
forAllSystems = nixpkgs.lib.genAttrs [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
pkgsFor = system: import nixpkgs { inherit system; };
genToolchainInputs =
pkgs: with pkgs; [
cmake
gcc
gdb
lldb
just
direnv
clang-tools
trash-cli
];
genLibInputs =
pkgs: with pkgs; [
# lib from Nixpkgs
# pkgs.fmt
];
in
{
devShells = forAllSystems (
system:
let
pkgs = pkgsFor system;
in
{
default = pkgs.mkShell {
nativeBuildInputs = genToolchainInputs pkgs;
buildInputs = genLibInputs pkgs;
shellHook = ''
echo "nix devShell for cpp-template"
echo " cmake : $(cmake --version | head -1)"
echo " gcc : $(gcc --version | head -1)"
echo " gdb : $(gdb --version | head -1)"
echo " lldb : $(lldb --version | head -1)"
echo " just : $(just --version | head -1)"
echo " clangd: $(clangd --version | head -1)"
'';
};
}
);
};
}