{ description = "Flake-based development environment for C++."; inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; # unstable Nixpkgs outputs = { self, ... }@inputs: let supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; forEachSupportedSystem = f: inputs.nixpkgs.lib.genAttrs supportedSystems ( system: f { pkgs = import inputs.nixpkgs { inherit system; }; } ); in { devShells = forEachSupportedSystem ( { pkgs }: { default = pkgs.mkShell.override { # Override stdenv in order to change compiler: stdenv = pkgs.clangStdenv; # Comment the line above if you want GCC } { packages = with pkgs; [ clang-tools # IMPORTANT - it **always** MUST stay right above clang clang codespell cppcheck doxygen gtest lcov vcpkg vcpkg-tool # BUILD pkg-config meson ninja just # LIBRARIES libcxx # DEBUGGERS lldb ] ++ (if system == "aarch64-darwin" then [ ] else [ gdb ]); env = { # Tell clangd to use the real clang wrapper that *knows* about include paths. CLANGD_FLAGS = "--query-driver=${pkgs.clang}/bin/clang*"; # Ensure Meson picks clang instead of GCC. CC = "${pkgs.clang}/bin/clang"; CXX = "${pkgs.clang}/bin/clang++"; }; }; } ); # Feel free to delete this once the project is initialized. templates.default = { path = ./.; description = "Meson-based C++ project template"; }; }; }