add llvm flake

This commit is contained in:
aditya 2023-12-14 19:07:32 +05:30
parent 0fe24de12e
commit db45c780d1
Signed by: aditya
SSH key fingerprint: SHA256:jL1IvWsjjlPtw6HvDIHfXfhO9IkIokNEyIfuFhSdoyU
3 changed files with 115 additions and 0 deletions

View file

@ -27,6 +27,11 @@
description = "LaTeX flake";
};
llvm = {
path = ./llvm;
description = "LLVM-build flake";
};
python = {
path = ./python;
description = "Python flake";

61
llvm/flake.lock Normal file
View file

@ -0,0 +1,61 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1701680307,
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1702312524,
"narHash": "sha256-gkZJRDBUCpTPBvQk25G0B7vfbpEYM5s5OZqghkjZsnE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a9bf124c46ef298113270b1f84a164865987a91c",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

49
llvm/flake.nix Normal file
View file

@ -0,0 +1,49 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
config = { allowUnfree = true; };
};
gccForLibs = pkgs.stdenv.cc.cc;
in {
name = "LLVM";
description = "LLVM-build toolchain";
devShell = pkgs.mkShell {
buildInputs = with pkgs; [
bashInteractive
python3
ninja
cmake
llvmPackages_17.llvm
];
# where to find libgcc
NIX_LDFLAGS="-L${gccForLibs}/lib/gcc/${pkgs.targetPlatform.config}/${gccForLibs.version}";
# teach clang about C startup file locations
CFLAGS="-B${gccForLibs}/lib/gcc/${pkgs.targetPlatform.config}/${gccForLibs.version} -B ${pkgs.stdenv.cc.libc}/lib";
cmakeFlags = [
"-DGCC_INSTALL_PREFIX=${pkgs.gcc}"
"-DC_INCLUDE_DIRS=${pkgs.stdenv.cc.libc.dev}/include"
"-GNinja"
# Debug for debug builds
"-DCMAKE_BUILD_TYPE=Release"
# inst will be our installation prefix
"-DCMAKE_INSTALL_PREFIX=../inst"
"-DLLVM_INSTALL_TOOLCHAIN_ONLY=ON"
# change this to enable the projects you need
"-DLLVM_ENABLE_PROJECTS=clang"
# enable libcxx* to come into play at runtimes
"-DLLVM_ENABLE_RUNTIMES=libcxx;libcxxabi"
# this makes llvm only to produce code for the current platform, this saves CPU time, change it to what you need
"-DLLVM_TARGETS_TO_BUILD=host"
];
};
});
}