diff --git a/build.sc b/build.sc index 00e3c07b2a2..6a1573253f1 100644 --- a/build.sc +++ b/build.sc @@ -242,7 +242,7 @@ trait CIRCTPanamaBinder def header = T(PathRef(millSourcePath / "jextract-headers.h")) - def circtInstallPath = T(os.Path(T.ctx.env.get("CIRCT_INSTALL_PATH").getOrElse("/usr/local"))) + def circtInstallPath = T.input(os.Path(T.ctx.env.get("CIRCT_INSTALL_PATH").getOrElse("/usr/local"))) def includePaths = T(Seq(PathRef(circtInstallPath() / "include"))) diff --git a/flake.lock b/flake.lock index f3c5c030851..37a57328c48 100644 --- a/flake.lock +++ b/flake.lock @@ -1,34 +1,15 @@ { "nodes": { - "circtSrc": { - "flake": false, - "locked": { - "lastModified": 1698112219, - "narHash": "sha256-ELek/eT4lgDISqMExhha/aTSr7EIgC/nR+P2BQlIn0Y=", - "ref": "refs/heads/main", - "rev": "beb9c36acde0232b866aacaf331843ac15272141", - "shallow": true, - "submodules": true, - "type": "git", - "url": "https://github.com/llvm/circt" - }, - "original": { - "shallow": true, - "submodules": true, - "type": "git", - "url": "https://github.com/llvm/circt" - } - }, "flake-utils": { "inputs": { "systems": "systems" }, "locked": { - "lastModified": 1694529238, - "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", "owner": "numtide", "repo": "flake-utils", - "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", "type": "github" }, "original": { @@ -39,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1697270026, - "narHash": "sha256-MrMgRlFe/B4RBRZXT++C+BV3FAGevJJCNKm87E+97jY=", + "lastModified": 1704480175, + "narHash": "sha256-NBMg0yaf83qWdocw0/Z1FKBGz+v/0Bek4iptvaqD9/8=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "4fc27bc59ea4b7b93fb372f4740303c7195dfb0b", + "rev": "b002bc51e4913faa89f03b335031799dbc74d69b", "type": "github" }, "original": { @@ -55,7 +36,6 @@ }, "root": { "inputs": { - "circtSrc": "circtSrc", "flake-utils": "flake-utils", "nixpkgs": "nixpkgs" } diff --git a/flake.nix b/flake.nix index e58f5064fb7..03cebc32443 100644 --- a/flake.nix +++ b/flake.nix @@ -4,15 +4,11 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/master"; flake-utils.url = "github:numtide/flake-utils"; - circtSrc = { - url = "git+https://github.com/llvm/circt?submodules=1&shallow=1"; - flake = false; - }; }; - outputs = { self, nixpkgs, flake-utils, circtSrc }@inputs: + outputs = { self, nixpkgs, flake-utils }@inputs: let - overlay = import ./overlay.nix circtSrc ; + overlay = import ./overlay.nix ; in flake-utils.lib.eachDefaultSystem (system: @@ -22,7 +18,6 @@ mill circt jextract - llvm-lit ]; in { @@ -30,7 +25,7 @@ devShell = pkgs.mkShell { buildInputs = deps; env = { - CIRCT_INSTALL_PATH = pkgs.circt; + CIRCT_INSTALL_PATH = pkgs.circt-all; }; }; } diff --git a/nix/espresso.nix b/nix/espresso.nix deleted file mode 100644 index 060ac0baad1..00000000000 --- a/nix/espresso.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ stdenv, fetchFromGitHub, cmake, ninja }: -stdenv.mkDerivation rec { - pname = "espresso"; - version = "2.4"; - nativeBuildInputs = [ cmake ninja ]; - src = fetchFromGitHub { - owner = "chipsalliance"; - repo = "espresso"; - rev = "v${version}"; - sha256 = "sha256-z5By57VbmIt4sgRgvECnLbZklnDDWUA6fyvWVyXUzsI="; - }; -} - diff --git a/nix/llvm-lit.nix b/nix/llvm-lit.nix deleted file mode 100644 index 3c71fddf6b6..00000000000 --- a/nix/llvm-lit.nix +++ /dev/null @@ -1,50 +0,0 @@ -{ fetchFromGitHub, - python3, - stdenv, cmake, ninja, makeWrapper }: -let - src = fetchFromGitHub { - owner = "llvm"; - repo = "llvm-project"; - rev = "llvmorg-17.0.3"; - hash = "sha256-fXkYSYwhMeY3nLuuSlO2b/TpTxa+61zxmsfFg7a2Gbo="; - }; - - llvm-lit = python3.pkgs.buildPythonPackage { - inherit src; - - pname = "llvm-lit"; - version = "17.0.3"; - format = "setuptools"; - sourceRoot = "source/llvm/utils/lit"; - propagatedBuildInputs = [ - python3.pkgs.setuptools - ]; - doCheck = false; - }; -in -stdenv.mkDerivation { - inherit src; - - pname = "llvm-lit"; - version = "17.0.3"; - nativeBuildInputs = [ cmake ninja python3 makeWrapper ]; - cmakeDir = "../llvm"; - cmakeFlags = [ - "-DLLVM_TARGETS_TO_BUILD=X86" - "-DLLVM_INSTALL_UTILS=ON" - "-DLLVM_INCLUDE_UTILS=ON" - "-DLLVM_INCLUDE_RUNTIMES=OFF" - "-DLLVM_INCLUDE_EXAMPLES=OFF" - "-DLLVM_INCLUDE_BENCHMARKS=OFF" - "-DLLVM_ENABLE_OCAMLDOC=OFF" - "-DLLVM_BUILD_RUNTIME=OFF" - "-DLLVM_BUILD_TOOLS=OFF" - ]; - - postInstall = '' - makeWrapper ${llvm-lit}/bin/lit $out/bin/llvm-lit \ - --prefix PATH : $out/bin - ln -s ${llvm-lit}/lib/python* $out/lib/ - cp -r ${llvm-lit}/nix-support $out/ - ''; -} diff --git a/overlay.nix b/overlay.nix index da090bc8946..33037308f9c 100644 --- a/overlay.nix +++ b/overlay.nix @@ -1,10 +1,10 @@ -circtSrc: final: prev: +final: prev: { mill = (prev.mill.overrideAttrs (oldAttrs: rec { - version = "0.11.5"; + version = "0.11.6"; src = prev.fetchurl { url = "https://github.com/com-lihaoyi/mill/releases/download/${version}/${version}-assembly"; - hash = "sha256-sCJMCy4TLRQV3zI28Aydv5a8OV8OHOjLbwhfyIlxOeY="; + hash = "sha256-vGhjnOKvR2RdgFx3WsM217SO9gcKZknPaf7LKo3SJPU="; }; })).override { jre = final.openjdk21; @@ -24,32 +24,30 @@ circtSrc: final: prev: }; })); - espresso = final.callPackage ./nix/espresso.nix { }; - circt = prev.circt.overrideAttrs (old: rec { - version = circtSrc.shortRev; - cmakeFlags = [ - "-DBUILD_SHARED_LIBS=ON" - "-DLLVM_ENABLE_BINDINGS=OFF" - "-DLLVM_ENABLE_OCAMLDOC=OFF" - "-DLLVM_BUILD_EXAMPLES=OFF" - "-DLLVM_OPTIMIZED_TABLEGEN=ON" - "-DLLVM_ENABLE_PROJECTS=mlir" - "-DLLVM_EXTERNAL_PROJECTS=circt" - "-DLLVM_EXTERNAL_CIRCT_SOURCE_DIR=.." - "-DCIRCT_LLHD_SIM_ENABLED=OFF" +# This script can be used for override circt for debuging. +# circt = prev.circt.overrideAttrs (old: rec { +# version = "nightly"; +# src = final.fetchFromGitHub { +# owner = "llvm"; +# repo = "circt"; +# rev = "57372957e8365b34ca469299b8c864d830e836a1"; +# sha256 = "sha256-gExhWkhVhIpTKRCfF26pZnrcrf//ASQJDxEKbYc570s="; +# fetchSubmodules = true; +# }; +# preConfigure = '' +# find ./test -name '*.mlir' -exec sed -i 's|/usr/bin/env|${final.coreutils}/bin/env|g' {} \; +# substituteInPlace cmake/modules/GenVersionFile.cmake --replace "unknown git version" "nightly" +# ''; +# }); + circt-all = final.symlinkJoin { + name = "circt-all"; + paths = with final; [ + circt + circt.dev + circt.lib + circt.llvm + circt.llvm.dev + circt.llvm.lib ]; - src = circtSrc; - preConfigure = '' - find ./test -name '*.mlir' -exec sed -i 's|/usr/bin/env|${final.coreutils}/bin/env|g' {} \; - substituteInPlace cmake/modules/GenVersionFile.cmake --replace "unknown git version" "git version ${version}" - ''; - installPhase = '' - runHook preInstall - mkdir -p $out - CMAKE_INSTALL_PREFIX=$out cmake --build . --target install --config Release - runHook postInstall - ''; - }); - - llvm-lit = final.callPackage ./nix/llvm-lit.nix { }; + }; }