Skip to content

Commit

Permalink
fix: workaround for cmake bug in nix
Browse files Browse the repository at this point in the history
  • Loading branch information
SharzyL committed Oct 22, 2022
1 parent c617242 commit 11b83b6
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ let
sha256 = "sha256-z5By57VbmIt4sgRgvECnLbZklnDDWUA6fyvWVyXUzsI=";
};
};
circt = pkgs.stdenv.mkDerivation rec {
circt = pkgs.stdenv.mkDerivation {
pname = "circt";
version = "r4396.ce85204ca";
nativeBuildInputs = with pkgs; [ cmake ninja python3 git ];
src = pkgs.fetchFromGitHub {
owner = "llvm";
repo = "circt";
rev = "da364ea448b70aaa710f9e17063ed745db23b463";
sha256 = "sha256-oS+wh/hJeJcXj5RoxsUOOX8wMsxgMAMdQtPpyENO0JM=";
rev = "6937e9b8b5e2a525f043ab89eb16812f92b42c62";
sha256 = "sha256-Lpu8J9izWvtYqibJQV0xEldk406PJobUM9WvTmNS3g4=";
fetchSubmodules = true;
};
cmakeFlags = [
Expand All @@ -44,6 +44,15 @@ let
'';
};

verilator = pkgs.verilator.overrideAttrs (old: {
src = pkgs.fetchFromGitHub {
owner = "verilator";
repo = "verilator";
rev = "2e4f5c863ffa6ab1afca883559ee5a6ca989e9d7";
sha256 = "sha256-jANlrumSGISeNB7MDrXqY2G6jMgrPApzk/1SoO92N2Y=";
};
});

# nix cc-wrapper will add --gcc-toolchain to clang flags. However, when we want to use
# our custom libc and compilerrt, clang will only search these libs in --gcc-toolchain
# folder. To avoid this wierd behavior of clang, we need to remove --gcc-toolchain options
Expand Down Expand Up @@ -72,6 +81,7 @@ in pkgs.mkShellNoCC {
fmt glog
];
shellHook = ''
export NIX_CC=" "
# because we removed --gcc-toolchain from cc-wrapper, we need to add gcc lib path back
export NIX_LDFLAGS_FOR_TARGET="$NIX_LDFLAGS_FOR_TARGET -L${pkgs.gccForLibs.lib}/lib"
'';
Expand Down

0 comments on commit 11b83b6

Please sign in to comment.