Skip to content

Commit abeac0e

Browse files
committed
format nix and setup pythonpath in shellHook
1 parent d6a5adc commit abeac0e

File tree

3 files changed

+41
-45
lines changed

3 files changed

+41
-45
lines changed

default.nix

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
1-
{
2-
lib,
3-
stdenv,
4-
gfortran,
5-
cmake,
6-
pfunit,
7-
pythonPackages,
8-
llvmPackages
9-
} :
1+
{ lib, stdenv, gfortran, cmake, pfunit, pythonPackages, llvmPackages }:
102
stdenv.mkDerivation {
11-
name = "call_py_fort";
12-
src = ./.;
3+
name = "call_py_fort";
4+
src = ./.;
135

14-
nativeBuildInputs = [ pfunit ] ++ lib.optional stdenv.isDarwin llvmPackages.openmp;
15-
buildInputs = [ gfortran gfortran.cc.lib cmake gfortran.cc pfunit pythonPackages.python ];
16-
propagatedBuildInputs = [ pythonPackages.cffi pythonPackages.numpy ] ;
17-
doCheck = true;
6+
nativeBuildInputs = [ pfunit ]
7+
++ lib.optional stdenv.isDarwin llvmPackages.openmp;
8+
buildInputs =
9+
[ gfortran gfortran.cc.lib cmake gfortran.cc pfunit pythonPackages.python ];
10+
propagatedBuildInputs = [ pythonPackages.cffi pythonPackages.numpy ];
11+
doCheck = true;
1812

19-
preCheck = ''
20-
export PYTHONPATH=$(pwd)/../test:$PYTHONPATH
21-
# for mac
22-
export DYLD_LIBRARY_PATH=$(pwd)/src
23-
# for linux
24-
export LD_LIBRARY_PATH=$(pwd)/src
25-
'';
26-
inherit pfunit;
13+
preCheck = ''
14+
export PYTHONPATH=$(pwd)/../test:$PYTHONPATH
15+
# for mac
16+
export DYLD_LIBRARY_PATH=$(pwd)/src
17+
# for linux
18+
export LD_LIBRARY_PATH=$(pwd)/src
19+
'';
20+
shellHook = ''
21+
export PYTHONPATH=$(pwd)/test:$PYTHONPATH
22+
# for mac
23+
export DYLD_LIBRARY_PATH=$(pwd)/src
24+
# for linux
25+
export LD_LIBRARY_PATH=$(pwd)/src
26+
'';
27+
inherit pfunit;
2728

2829
}

pfunit.nix

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,14 @@
1-
{
2-
stdenv,
3-
m4,
4-
fetchFromGitHub,
5-
gfortran,
6-
cmake,
7-
python3
8-
} :
1+
{ stdenv, m4, fetchFromGitHub, gfortran, cmake, python3 }:
92
stdenv.mkDerivation {
10-
name = "pFUnit";
11-
src = fetchFromGitHub {
12-
owner = "Goddard-Fortran-Ecosystem";
13-
repo = "pFUnit";
14-
rev = "v4.2.1";
15-
fetchSubmodules = true;
16-
sha256 = "sha256-yjuJHvJ83PAQBDDk7TD4b6VWGoKbiexdjBCTLsNIIxI=";
3+
name = "pFUnit";
4+
src = fetchFromGitHub {
5+
owner = "Goddard-Fortran-Ecosystem";
6+
repo = "pFUnit";
7+
rev = "v4.2.1";
8+
fetchSubmodules = true;
9+
sha256 = "sha256-yjuJHvJ83PAQBDDk7TD4b6VWGoKbiexdjBCTLsNIIxI=";
1710

18-
};
19-
buildInputs = [ python3 gfortran cmake gfortran.cc m4 ];
11+
};
12+
buildInputs = [ python3 gfortran cmake gfortran.cc m4 ];
2013

2114
}

shell.nix

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
let
2-
nixpkgs = import <nixpkgs> { };
3-
pfunit = nixpkgs.callPackage ./pfunit.nix { };
4-
in
5-
nixpkgs.callPackage ./default.nix { inherit pfunit; pythonPackages = nixpkgs.python3Packages; }
1+
let
2+
nixpkgs = import <nixpkgs> { };
3+
pfunit = nixpkgs.callPackage ./pfunit.nix { };
4+
in nixpkgs.callPackage ./default.nix {
5+
inherit pfunit;
6+
pythonPackages = nixpkgs.python3Packages;
7+
}

0 commit comments

Comments
 (0)