Created
June 16, 2022 07:00
-
-
Save shiryel/ce1b5320424661ed6c9572453a462c7e to your computer and use it in GitHub Desktop.
Nix flake for Clang
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
description = "Clang Template"; | |
inputs = { | |
nixpkgs_stable.url = "github:NixOS/nixpkgs/nixos-22.05"; | |
flake-utils.url = "github:numtide/flake-utils/v1.0.0"; | |
}; | |
outputs = { self, nixpkgs_stable, flake-utils }: | |
flake-utils.lib.eachDefaultSystem | |
(system: | |
let | |
pkgs = import nixpkgs_stable { system = system; }; | |
llvm = pkgs.llvmPackages_13; | |
packages = with pkgs; [ | |
# XXX: the order of include matters | |
pkgs.clang-tools | |
llvm.clang # clangd | |
# debugger | |
llvm.lldb | |
]; | |
in | |
rec { | |
devShell = pkgs.mkShell { | |
nativeBuildInputs = [ pkgs.pkg-config ]; | |
packages = packages; | |
CPATH = builtins.concatStringsSep ":" [ | |
(pkgs.lib.makeSearchPathOutput "dev" "include" ([ llvm.libcxx llvm.libcxxabi ])) | |
(pkgs.lib.makeSearchPath "resource-root/include" ([ llvm.clang ])) | |
]; | |
}; | |
defaultPackage = llvm.stdenv.mkDerivation rec { | |
pname = "Clang Template"; | |
version = "0.1.0"; | |
src = ./.; | |
nativeBuildInputs = [ pkgs.pkg-config ]; | |
buildInputs = packages; | |
sconsFlags = ""; | |
enableParallelBuilding = true; | |
}; | |
} | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment