mirror of
https://git.adityakumar.xyz/flakes.git
synced 2024-11-09 14:19:43 +00:00
add llvm flake
This commit is contained in:
parent
0fe24de12e
commit
db45c780d1
3 changed files with 115 additions and 0 deletions
|
@ -27,6 +27,11 @@
|
||||||
description = "LaTeX flake";
|
description = "LaTeX flake";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
llvm = {
|
||||||
|
path = ./llvm;
|
||||||
|
description = "LLVM-build flake";
|
||||||
|
};
|
||||||
|
|
||||||
python = {
|
python = {
|
||||||
path = ./python;
|
path = ./python;
|
||||||
description = "Python flake";
|
description = "Python flake";
|
||||||
|
|
61
llvm/flake.lock
Normal file
61
llvm/flake.lock
Normal 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
49
llvm/flake.nix
Normal 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"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
Loading…
Reference in a new issue