Skip to content

Commit

Permalink
Merge pull request #3713 from chipsalliance/nix
Browse files Browse the repository at this point in the history
bump and update nix to use upstreamed packages
  • Loading branch information
sequencer committed Jan 6, 2024
2 parents 3221f75 + 1af4eab commit 4eb5f61
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 128 deletions.
2 changes: 1 addition & 1 deletion build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -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")))

Expand Down
32 changes: 6 additions & 26 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 3 additions & 8 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -22,15 +18,14 @@
mill
circt
jextract
llvm-lit
];
in
{
legacyPackages = pkgs;
devShell = pkgs.mkShell {
buildInputs = deps;
env = {
CIRCT_INSTALL_PATH = pkgs.circt;
CIRCT_INSTALL_PATH = pkgs.circt-all;
};
};
}
Expand Down
13 changes: 0 additions & 13 deletions nix/espresso.nix

This file was deleted.

50 changes: 0 additions & 50 deletions nix/llvm-lit.nix

This file was deleted.

58 changes: 28 additions & 30 deletions overlay.nix
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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 { };
};
}

0 comments on commit 4eb5f61

Please sign in to comment.