mirror of
https://github.com/Feliix42/dotfiles.git
synced 2024-11-22 14:06:30 +00:00
move MLIR flake to repository
This commit is contained in:
parent
1cc50954bf
commit
3c7b6e46ac
4 changed files with 14 additions and 177 deletions
|
@ -7,14 +7,18 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1,
|
"lastModified": 1674741247,
|
||||||
"narHash": "sha256-aKkWcnDgBrVE0XwU+i2w44gbGKR7OFQdh0RYuMIW9YM=",
|
"narHash": "sha256-bOEy7Ru/Ol+4LyZe/05HJQ0VCvADY1I+DJwE9dOuGTo=",
|
||||||
"path": "/nix/store/nf5bkjpbkf4sch75b6q8jba66imbv8w3-source/entropy/nixos/mlir",
|
"owner": "Feliix42",
|
||||||
"type": "path"
|
"repo": "mlir.nix",
|
||||||
|
"rev": "d35d1beb45fc9f6eea75d054c27f9e27fcebb8b0",
|
||||||
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"path": "/nix/store/nf5bkjpbkf4sch75b6q8jba66imbv8w3-source/entropy/nixos/mlir",
|
"owner": "Feliix42",
|
||||||
"type": "path"
|
"ref": "main",
|
||||||
|
"repo": "mlir.nix",
|
||||||
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixos-hardware": {
|
"nixos-hardware": {
|
||||||
|
@ -35,11 +39,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1674333941,
|
"lastModified": 1674407282,
|
||||||
"narHash": "sha256-jelQS56nVVFXGOZg6yUZ/3QWgU1Loa4Bzd4+TEPJX+c=",
|
"narHash": "sha256-2qwc8mrPINSFdWffPK+ji6nQ9aGnnZyHSItVcYDZDlk=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "339fc3dcc98f39d08496fb90c0d6b5fb81519246",
|
"rev": "ab1254087f4cdf4af74b552d7fc95175d9bdbb49",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#inputs.nixpkgs.follows = "nixpkgs";
|
#inputs.nixpkgs.follows = "nixpkgs";
|
||||||
#};
|
#};
|
||||||
mlir = {
|
mlir = {
|
||||||
url = "./mlir";
|
url = "github:Feliix42/mlir.nix/main";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
{
|
|
||||||
"nodes": {
|
|
||||||
"nixpkgs": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1673800717,
|
|
||||||
"narHash": "sha256-SFHraUqLSu5cC6IxTprex/nTsI81ZQAtDvlBvGDWfnA=",
|
|
||||||
"owner": "NixOS",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "2f9fd351ec37f5d479556cd48be4ca340da59b8f",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"id": "nixpkgs",
|
|
||||||
"ref": "nixos-22.11",
|
|
||||||
"type": "indirect"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs": "nixpkgs"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": "root",
|
|
||||||
"version": 7
|
|
||||||
}
|
|
|
@ -1,141 +0,0 @@
|
||||||
{
|
|
||||||
description = "Custom-Built MLIR";
|
|
||||||
|
|
||||||
# Nixpkgs / NixOS version to use.
|
|
||||||
inputs.nixpkgs.url = "nixpkgs/nixos-22.11";
|
|
||||||
|
|
||||||
outputs = { self, nixpkgs }:
|
|
||||||
let
|
|
||||||
|
|
||||||
# git revision to use (for version and git pull
|
|
||||||
gitRevision = "49caf7012170422afa84868598063818f9344228";
|
|
||||||
|
|
||||||
# to work with older version of flakes
|
|
||||||
lastModifiedDate = self.lastModifiedDate or self.lastModified or "19700101";
|
|
||||||
|
|
||||||
# Generate a user-friendly version number.
|
|
||||||
version = builtins.substring 0 8 lastModifiedDate;
|
|
||||||
# version = gitRevision;
|
|
||||||
|
|
||||||
# System types to support.
|
|
||||||
supportedSystems = [ "x86_64-linux" ]; #"x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
|
|
||||||
|
|
||||||
# Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'.
|
|
||||||
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
|
||||||
|
|
||||||
# Nixpkgs instantiated for supported system types.
|
|
||||||
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; overlays = [ self.overlay ]; });
|
|
||||||
|
|
||||||
in
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
# A Nixpkgs overlay.
|
|
||||||
overlay = final: prev: {
|
|
||||||
|
|
||||||
mlir = with final; llvmPackages_14.stdenv.mkDerivation rec {
|
|
||||||
name = "mlir-${version}";
|
|
||||||
|
|
||||||
#readOnlySrc = ./.;
|
|
||||||
|
|
||||||
#src = ./.;
|
|
||||||
#src = runCommand "${name}-src-${version}" {} (''
|
|
||||||
#mkdir -p "$out"
|
|
||||||
#cp -r ${readOnlySrc}/cmake "$out"
|
|
||||||
#cp -r ${readOnlySrc}/llvm "$out"
|
|
||||||
#cp -r ${readOnlySrc}/third-party "$out"
|
|
||||||
#'');
|
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
|
||||||
owner = "llvm";
|
|
||||||
repo = "llvm-project";
|
|
||||||
rev = gitRevision;
|
|
||||||
sha256 = "sha256-j+ladpx8NfJGszj17oRkgvb4U2race+2DTKLtRZGeUM=";
|
|
||||||
};
|
|
||||||
|
|
||||||
sourceRoot = "source/llvm";
|
|
||||||
|
|
||||||
nativeBuildInputs = [
|
|
||||||
python3
|
|
||||||
ninja
|
|
||||||
cmake
|
|
||||||
ncurses
|
|
||||||
zlib
|
|
||||||
#pkg-config
|
|
||||||
llvmPackages_14.llvm
|
|
||||||
llvmPackages_14.clang
|
|
||||||
llvmPackages_14.bintools
|
|
||||||
];
|
|
||||||
|
|
||||||
buildInputs = [ libxml2 ];
|
|
||||||
|
|
||||||
#propagatedBuildInputs = [ ncurses zlib ];
|
|
||||||
|
|
||||||
# where to find libgcc
|
|
||||||
#NIX_LDFLAGS="-L${gccForLibs}/lib/gcc/${targetPlatform.config}/${gccForLibs.version}"; # -L ${zlib}/lib";
|
|
||||||
# teach clang about C startup file locations
|
|
||||||
#CFLAGS="-B${gccForLibs}/lib/gcc/${targetPlatform.config}/${gccForLibs.version} -B ${stdenv.cc.libc}/lib";
|
|
||||||
|
|
||||||
#LD_LIBRARY_PATH="${zlib}/lib:${ncurses}/lib:$LD_LIBRARY_PATH";
|
|
||||||
|
|
||||||
cmakeFlags = [
|
|
||||||
# "-DGCC_INSTALL_PREFIX=${gcc}"
|
|
||||||
#"-DC_INCLUDE_DIRS=${stdenv.cc.libc.dev}/include"
|
|
||||||
"-GNinja"
|
|
||||||
# Debug for debug builds
|
|
||||||
"-DCMAKE_BUILD_TYPE=Release"
|
|
||||||
# from the original LLVM expr
|
|
||||||
"-DLLVM_LINK_LLVM_DYLIB=ON"
|
|
||||||
# inst will be our installation prefix
|
|
||||||
#"-DCMAKE_INSTALL_PREFIX=../inst"
|
|
||||||
# "-DLLVM_INSTALL_TOOLCHAIN_ONLY=ON"
|
|
||||||
# install tools like FileCheck
|
|
||||||
"-DLLVM_INSTALL_UTILS=ON"
|
|
||||||
# change this to enable the projects you need
|
|
||||||
"-DLLVM_ENABLE_PROJECTS=mlir"
|
|
||||||
# "-DLLVM_BUILD_EXAMPLES=ON"
|
|
||||||
# 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=X86"
|
|
||||||
# -DLLVM_TARGETS_TO_BUILD="X86;NVPTX;AMDGPU" \
|
|
||||||
"-DLLVM_ENABLE_ASSERTIONS=ON"
|
|
||||||
# Using clang and lld speeds up the build, we recomment adding:
|
|
||||||
"-DCMAKE_C_COMPILER=clang"
|
|
||||||
"-DCMAKE_CXX_COMPILER=clang++"
|
|
||||||
"-DLLVM_ENABLE_LLD=ON"
|
|
||||||
#"-DLLVM_USE_LINKER=${llvmPackages_14.bintools}/bin/lld"
|
|
||||||
# CCache can drastically speed up further rebuilds, try adding:
|
|
||||||
#"-DLLVM_CCACHE_BUILD=ON"
|
|
||||||
# libxml2 needs to be disabled because the LLVM build system ignores its .la
|
|
||||||
# file and doesn't link zlib as well.
|
|
||||||
# https://github.com/ClangBuiltLinux/tc-build/issues/150#issuecomment-845418812
|
|
||||||
#"-DLLVM_ENABLE_LIBXML2=OFF"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
# Provide some binary packages for selected system types.
|
|
||||||
packages = forAllSystems (system:
|
|
||||||
{
|
|
||||||
inherit (nixpkgsFor.${system}) mlir;
|
|
||||||
});
|
|
||||||
|
|
||||||
# The default package for 'nix build'. This makes sense if the
|
|
||||||
# flake provides only one package or there is a clear "main"
|
|
||||||
# package.
|
|
||||||
defaultPackage = forAllSystems (system: self.packages.${system}.mlir);
|
|
||||||
|
|
||||||
# A NixOS module, if applicable (e.g. if the package provides a system service).
|
|
||||||
nixosModules.mlir =
|
|
||||||
{ pkgs, ... }:
|
|
||||||
{
|
|
||||||
nixpkgs.overlays = [ self.overlay ];
|
|
||||||
|
|
||||||
environment.systemPackages = [ pkgs.mlir ];
|
|
||||||
|
|
||||||
#systemd.services = { ... };
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue