From b44fd03b5a49bfcfe9fe116610f9ee008b9e6c72 Mon Sep 17 00:00:00 2001 From: Alejandro Gallo Date: Tue, 12 Oct 2021 19:26:55 +0200 Subject: [PATCH] Add shellHook to clang.nix --- etc/nix/clang.nix | 5 +++++ shell.nix | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/etc/nix/clang.nix b/etc/nix/clang.nix index 6cc6156..89afa25 100644 --- a/etc/nix/clang.nix +++ b/etc/nix/clang.nix @@ -5,5 +5,10 @@ clang llvmPackages.openmp ]; + + shellHook = '' + export OMPI_CC=clang + export OMPI_CXX=clang++ + ''; } diff --git a/shell.nix b/shell.nix index a949b61..7c80d64 100644 --- a/shell.nix +++ b/shell.nix @@ -1,9 +1,12 @@ { pkgs ? import {} , with-clang ? false }: let + + clang = import ./etc/nix/clang.nix { inherit pkgs; }; + compiler-configuration = if with-clang - then (import ./etc/nix/clang.nix { inherit pkgs; }).buildInputs + then clang.buildInputs else [ pkgs.gcc ]; in @@ -30,6 +33,8 @@ pkgs.mkShell { export OPENBLAS_PATH=${pkgs.openblas} export SCALAPACK_PATH=${pkgs.scalapack} export LD_LIBRARY_PATH=${pkgs.scalapack}/lib:$LD_LIBRARY_PATH - ''; + '' + + (if with-clang then clang.shellHook else "") + ; }