lol
1{
2 cmake,
3 eigen,
4 fetchFromGitHub,
5 gtest,
6 lib,
7 stdenv,
8}:
9
10stdenv.mkDerivation (finalAttrs: {
11 pname = "eigenrand";
12 version = "0.5.1";
13
14 src = fetchFromGitHub {
15 owner = "bab2min";
16 repo = "EigenRand";
17 rev = "v${finalAttrs.version}";
18 hash = "sha256-mrpkWIb6kfLvppmIfzhjF1/3m1zSd8XG1D07V6Zjlu0=";
19 };
20
21 # Avoid downloading googletest: we already have it.
22 postPatch = ''
23 substituteInPlace CMakeLists.txt --replace-fail \
24 "FetchContent_MakeAvailable(googletest)" \
25 "add_subdirectory(${gtest.src} googletest SYSTEM)"
26
27 # broken by https://gitlab.com/libeigen/eigen/-/merge_requests/688
28 # ref. https://github.com/NixOS/nixpkgs/pull/364362
29 rm test/test_mv.cpp
30 '';
31
32 postInstall = ''
33 # Remove installed tests and googletest stuff
34 rm -rf $out/bin $out/include/gmock $out/include/gtest $out/lib
35 '';
36
37 nativeBuildInputs = [ cmake ];
38 propagatedBuildInputs = [ eigen ];
39 checkInputs = [ gtest ];
40
41 doCheck = true;
42
43 cmakeFlags = [ "-DCMAKE_CTEST_ARGUMENTS=--exclude-regex;EigenRand-test" ];
44
45 meta = {
46 description = "Fastest Random Distribution Generator for Eigen";
47 homepage = "https://github.com/bab2min/EigenRand";
48 license = lib.licenses.mit;
49 maintainers = with lib.maintainers; [ nim65s ];
50 platforms = lib.platforms.unix;
51 };
52})