nixpkgs/pkgs/by-name/ei/eigenrand/package.nix
Guilhem Saurel c3cc52fe6b eigenrand: init at 0.5.1
Co-authored-by: Aleksana <alexander.huang.y@gmail.com>
2024-09-12 11:06:33 +02:00

48 lines
1.1 KiB
Nix

{
cmake,
eigen,
fetchFromGitHub,
gtest,
lib,
stdenv,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "eigenrand";
version = "0.5.1";
src = fetchFromGitHub {
owner = "bab2min";
repo = "EigenRand";
rev = "v${finalAttrs.version}";
hash = "sha256-mrpkWIb6kfLvppmIfzhjF1/3m1zSd8XG1D07V6Zjlu0=";
};
# Avoid downloading googletest: we already have it.
postPatch = ''
substituteInPlace CMakeLists.txt --replace-fail \
"FetchContent_MakeAvailable(googletest)" \
"add_subdirectory(${gtest.src} googletest SYSTEM)"
'';
postInstall = ''
# Remove installed tests and googletest stuff
rm -rf $out/bin $out/include/gmock $out/include/gtest $out/lib
'';
nativeBuildInputs = [ cmake ];
propagatedBuildInputs = [ eigen ];
checkInputs = [ gtest ];
doCheck = true;
cmakeFlags = [ "-DCMAKE_CTEST_ARGUMENTS=--exclude-regex;EigenRand-test" ];
meta = {
description = "Fastest Random Distribution Generator for Eigen";
homepage = "https://github.com/bab2min/EigenRand";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ nim65s ];
platforms = lib.platforms.unix;
};
})