Files
flakes/cpp/flake.nix
2026-02-23 21:52:19 +01:00

53 lines
1.3 KiB
Nix

{
description = "A C++ project flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
};
outputs = inputs@{ self, nixpkgs, flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
perSystem = { config, self', inputs', pkgs, system, ... }: {
packages.default = pkgs.stdenv.mkDerivation {
pname = "my-app";
version = "0.1.0";
src = ./.;
# Build-time dependencies (compilers, build systems)
nativeBuildInputs = with pkgs; [
cmake
ninja
pkg-config
];
# Runtime dependencies (libraries your code links against)
buildInputs = with pkgs; [
# boost
# fmt
];
# Optional: Configure CMake flags
cmakeFlags = [
"-DCMAKE_BUILD_TYPE=Release"
];
};
devShells.default = pkgs.mkShell {
inputsFrom = [ self'.packages.default ];
packages = with pkgs; [
gdb
clang-tools # Includes clang-format and clangd (LSP)
valgrind
];
shellHook = ''
'';
};
};
};
}