Add shellHook to clang.nix

This commit is contained in:
Alejandro Gallo 2021-10-12 19:26:55 +02:00
parent 3446c6abba
commit b44fd03b5a
2 changed files with 12 additions and 2 deletions

View File

@ -5,5 +5,10 @@
clang clang
llvmPackages.openmp llvmPackages.openmp
]; ];
shellHook = ''
export OMPI_CC=clang
export OMPI_CXX=clang++
'';
} }

View File

@ -1,9 +1,12 @@
{ pkgs ? import <nixpkgs> {} , with-clang ? false }: { pkgs ? import <nixpkgs> {} , with-clang ? false }:
let let
clang = import ./etc/nix/clang.nix { inherit pkgs; };
compiler-configuration compiler-configuration
= if with-clang = if with-clang
then (import ./etc/nix/clang.nix { inherit pkgs; }).buildInputs then clang.buildInputs
else [ pkgs.gcc ]; else [ pkgs.gcc ];
in in
@ -30,6 +33,8 @@ pkgs.mkShell {
export OPENBLAS_PATH=${pkgs.openblas} export OPENBLAS_PATH=${pkgs.openblas}
export SCALAPACK_PATH=${pkgs.scalapack} export SCALAPACK_PATH=${pkgs.scalapack}
export LD_LIBRARY_PATH=${pkgs.scalapack}/lib:$LD_LIBRARY_PATH export LD_LIBRARY_PATH=${pkgs.scalapack}/lib:$LD_LIBRARY_PATH
''; ''
+ (if with-clang then clang.shellHook else "")
;
} }