nixpkgs/pkgs/by-name/ri/ripser/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

57 lines
1.5 KiB
Nix
Raw Permalink Normal View History

{ lib, stdenv, fetchFromGitHub
2016-08-04 09:21:48 +01:00
, useCoefficients ? false
, indicateProgress ? false
, useGoogleHashmap ? false, sparsehash ? null
, fileFormat ? "lowerTriangularCsv"
}:
2024-08-13 21:04:55 +01:00
assert lib.assertOneOf "fileFormat" fileFormat
["lowerTriangularCsv" "upperTriangularCsv" "dipha"];
2016-08-04 09:21:48 +01:00
assert useGoogleHashmap -> sparsehash != null;
let
version = "1.2.1";
2016-08-04 09:21:48 +01:00
in
stdenv.mkDerivation {
2019-08-13 22:52:01 +01:00
pname = "ripser";
inherit version;
2016-08-04 09:21:48 +01:00
src = fetchFromGitHub {
owner = "Ripser";
repo = "ripser";
rev = "v${version}";
sha256 = "sha256-BxmkPQ/nl5cF+xwQMTjXnLgkLgdmT/39y7Kzl2wDfpE=";
2016-08-04 09:21:48 +01:00
};
2024-08-13 21:04:55 +01:00
buildInputs = lib.optional useGoogleHashmap sparsehash;
2016-08-04 09:21:48 +01:00
buildFlags = [
"-std=c++11"
"-O3"
2016-08-04 09:21:48 +01:00
"-D NDEBUG"
]
2024-08-13 21:04:55 +01:00
++ lib.optional useCoefficients "-D USE_COEFFICIENTS"
++ lib.optional indicateProgress "-D INDICATE_PROGRESS"
++ lib.optional useGoogleHashmap "-D USE_GOOGLE_HASHMAP"
++ lib.optional (fileFormat == "lowerTriangularCsv") "-D FILE_FORMAT_LOWER_TRIANGULAR_CSV"
++ lib.optional (fileFormat == "upperTriangularCsv") "-D FILE_FORMAT_UPPER_TRIANGULAR_CSV"
++ lib.optional (fileFormat == "dipha") "-D FILE_FORMAT_DIPHA"
2016-08-04 09:21:48 +01:00
;
buildPhase = "c++ ripser.cpp -o ripser $buildFlags";
installPhase = ''
mkdir -p $out/bin
cp ripser $out/bin
'';
meta = {
description = "Lean C++ code for the computation of VietorisRips persistence barcodes";
mainProgram = "ripser";
homepage = "https://github.com/Ripser/ripser";
2021-01-15 13:21:58 +00:00
license = lib.licenses.lgpl3;
maintainers = with lib.maintainers; [erikryb];
platforms = lib.platforms.linux;
2016-08-04 09:21:48 +01:00
};
}