bscpkgs/pkgs/ovni/default.nix

56 lines
1.2 KiB
Nix
Raw Normal View History

2021-11-30 22:58:58 +08:00
{
stdenv
, lib
, cmake
, mpi
, fetchFromGitHub
, useGit ? false
2021-11-30 22:58:58 +08:00
, gitBranch ? "master"
2023-09-06 22:20:59 +08:00
, gitUrl ? "ssh://git@bscpm03.bsc.es/rarias/ovni.git"
, gitCommit ? "7a33deffb7aaae70527125d48428f22169c9d39e"
, enableDebug ? false
2021-11-30 22:58:58 +08:00
}:
with lib;
let
release = rec {
version = "1.4.1";
src = fetchFromGitHub {
owner = "bsc-pm";
repo = "ovni";
rev = "${version}";
hash = "sha256-/vv7Yy6dzoxuHjMc0h/vFFwWzysPLXFZIN2rbLT/SC8=";
} // { shortRev = "7a33def"; };
};
2021-11-30 22:58:58 +08:00
git = rec {
version = src.shortRev;
src = builtins.fetchGit {
url = gitUrl;
ref = gitBranch;
rev = gitCommit;
};
};
2021-11-30 22:58:58 +08:00
source = if (useGit) then git else release;
in
stdenv.mkDerivation rec {
pname = "ovni";
inherit (source) src version;
dontStrip = true;
separateDebugInfo = true;
2023-10-04 19:44:03 +08:00
postPatch = ''
patchShebangs --build test/
'';
buildInputs = [ cmake mpi ];
cmakeBuildType = if (enableDebug) then "Debug" else "Release";
cmakeFlags = [ "-DOVNI_GIT_COMMIT=${src.shortRev}" ];
preCheck = ''
export CTEST_OUTPUT_ON_FAILURE=1
'';
2023-10-04 19:31:55 +08:00
doCheck = true;
checkTarget = "test";
hardeningDisable = [ "all" ];
}