mirror of
https://git.adityakumar.xyz/flakes.git
synced 2024-11-21 18:22:53 +00:00
add c++ flake
This commit is contained in:
parent
8e89764acd
commit
d1116d5ec9
1 changed files with 40 additions and 0 deletions
40
flake-cpp.nix
Normal file
40
flake-cpp.nix
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
{
|
||||||
|
description = "A build environment for C++ programs";
|
||||||
|
|
||||||
|
inputs = { nixpkgs.url = "github:nixos/nixpkgs/master"; };
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs }:
|
||||||
|
let
|
||||||
|
pkgs = nixpkgs.legacyPackages.x86_64-linux.pkgs;
|
||||||
|
in {
|
||||||
|
devShell.x86_64-linux = pkgs.llvmPackages_16.libcxxStdenv.mkDerivation {
|
||||||
|
name = "A build environment for C++ programs";
|
||||||
|
buildInputs = [
|
||||||
|
pkgs.clang_16
|
||||||
|
pkgs.clang-tools
|
||||||
|
pkgs.clang-analyzer
|
||||||
|
pkgs.lldb_16
|
||||||
|
pkgs.llvmPackages_16.stdenv
|
||||||
|
pkgs.llvmPackages_16.libcxxStdenv
|
||||||
|
pkgs.llvmPackages_16.libcxxClang
|
||||||
|
pkgs.llvmPackages_16.compiler-rt
|
||||||
|
pkgs.llvmPackages_16.compiler-rt-libc
|
||||||
|
pkgs.llvmPackages_16.bintools
|
||||||
|
pkgs.llvmPackages_16.clangUseLLVM
|
||||||
|
pkgs.llvmPackages_16.libcxxabi
|
||||||
|
pkgs.llvmPackages_16.libcxx
|
||||||
|
pkgs.llvmPackages_16.libllvm
|
||||||
|
pkgs.llvmPackages_16.lld
|
||||||
|
pkgs.llvmPackages_16.bintools
|
||||||
|
];
|
||||||
|
shellHook = ''
|
||||||
|
echo "Usage: cxx -o bin source.cc"
|
||||||
|
export CXX_MODULE_FLAGS='-fimplicit-modules -fimplicit-module-maps -fprebuilt-module-path=.'
|
||||||
|
export CXX_SANITIZE_FLAGS='-fsanitize=address -fsanitize=leak -fsanitize=undefined -fsanitize=bounds -fsanitize=float-divide-by-zero -fsanitize=integer-divide-by-zero -fsanitize=nonnull-attribute -fsanitize=null -fsanitize=pointer-overflow -fsanitize=integer -fno-omit-frame-pointer'
|
||||||
|
export CXX_WARNING_FLAGS='-Weverything -Wno-c++98-compat'
|
||||||
|
alias cxx='clang++ -O1 -std=c++20 -stdlib=libc++ $(echo $CXX_MODULE_FLAGS $CXX_SANITIZE_FLAGS $CXX_WARNING_FLAGS) -g'
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue