aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraditya <bluenerd@protonmail.com>2023-12-14 19:07:32 +0530
committeraditya <bluenerd@protonmail.com>2023-12-14 19:07:32 +0530
commitdb45c780d1fcec0c7942e8727bcb2b8239a0dba8 (patch)
tree7bea0177b7f161b0039af254cb724b6b04a87d51
parent0fe24de12e9984e06cb9ae9b622def5f3cc57a18 (diff)
add llvm flakeHEADmaster
-rw-r--r--flake.nix5
-rw-r--r--llvm/flake.lock61
-rw-r--r--llvm/flake.nix49
3 files changed, 115 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix
index 30b6d72..20b5dd4 100644
--- a/flake.nix
+++ b/flake.nix
@@ -27,6 +27,11 @@
description = "LaTeX flake";
};
+ llvm = {
+ path = ./llvm;
+ description = "LLVM-build flake";
+ };
+
python = {
path = ./python;
description = "Python flake";
diff --git a/llvm/flake.lock b/llvm/flake.lock
new file mode 100644
index 0000000..3bfd004
--- /dev/null
+++ b/llvm/flake.lock
@@ -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
+}
diff --git a/llvm/flake.nix b/llvm/flake.nix
new file mode 100644
index 0000000..402a720
--- /dev/null
+++ b/llvm/flake.nix
@@ -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"
+ ];
+ };
+ });
+}