nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitLab,
5 python3Packages,
6 arpack,
7 petsc,
8 mpiCheckPhaseHook,
9 pythonSupport ? false,
10 withExamples ? false,
11 withArpack ? stdenv.hostPlatform.isLinux,
12}:
13let
14 slepcPackages = petsc.petscPackages.overrideScope (
15 final: prev: {
16 inherit pythonSupport;
17 mpiSupport = true;
18 arpack = final.callPackage arpack.override { useMpi = true; };
19 }
20 );
21in
22stdenv.mkDerivation (finalAttrs: {
23 pname = "slepc";
24 version = "3.24.2";
25
26 src = fetchFromGitLab {
27 owner = "slepc";
28 repo = "slepc";
29 tag = "v${finalAttrs.version}";
30 hash = "sha256-P6UjCvlXelEGp+ReNGbolcVIV9eQTmcOJDLjmJOZJeQ=";
31 };
32
33 postPatch = ''
34 # Fix slepc4py install prefix
35 substituteInPlace config/packages/slepc4py.py \
36 --replace-fail "slepc.prefixdir,'lib'" \
37 "slepc.prefixdir,'${python3Packages.python.sitePackages}'"
38
39 patchShebangs lib/slepc/bin
40 '';
41
42 nativeBuildInputs = [
43 python3Packages.python
44 ]
45 ++ lib.optionals pythonSupport [
46 python3Packages.setuptools
47 python3Packages.cython
48 ];
49
50 configureFlags =
51 lib.optionals withArpack [
52 "--with-arpack=1"
53 ]
54 ++ lib.optionals pythonSupport [
55 "--with-slepc4py=1"
56 ];
57
58 buildInputs = [
59 slepcPackages.mpi
60 ]
61 ++ lib.optionals withArpack [
62 slepcPackages.arpack
63 ];
64
65 propagatedBuildInputs = [
66 petsc
67 ];
68
69 enableParallelBuilding = true;
70
71 installTargets = [ (if withExamples then "install" else "install-lib") ];
72
73 __darwinAllowLocalNetworking = true;
74
75 nativeInstallCheckInputs = [
76 mpiCheckPhaseHook
77 ]
78 ++ lib.optionals pythonSupport [
79 python3Packages.pythonImportsCheckHook
80 python3Packages.unittestCheckHook
81 ];
82
83 doInstallCheck = true;
84
85 installCheckTarget = [ "check_install" ];
86
87 unittestFlagsArray = [
88 "-s"
89 "src/binding/slepc4py/test"
90 "-v"
91 ];
92
93 pythonImportsCheck = [ "slepc4py" ];
94
95 setupHook = ./setup-hook.sh;
96
97 meta = {
98 description = "Scalable Library for Eigenvalue Problem Computations";
99 homepage = "https://slepc.upv.es";
100 changelog = "https://gitlab.com/slepc/slepc/blob/v${finalAttrs.version}/CHANGELOG.md";
101 license = with lib.licenses; [
102 bsd2
103 ];
104 platforms = lib.platforms.unix;
105 maintainers = with lib.maintainers; [ qbisi ];
106 # Possible error running Fortran src/eps/tests/test7f with 1 MPI process
107 broken = stdenv.hostPlatform.isDarwin && withArpack;
108 };
109})