From a5f415516e94c2d456923f541f7e8bc5a79d7615 Mon Sep 17 00:00:00 2001 From: SharzyL Date: Sat, 22 Oct 2022 14:10:36 +0800 Subject: [PATCH] fix: workaround for cmake bug in nix details: https://github.com/NixOS/nixpkgs/pull/192943 --- shell.nix | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/shell.nix b/shell.nix index 182d908c82..86def86382 100644 --- a/shell.nix +++ b/shell.nix @@ -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 = [ @@ -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 @@ -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" '';