nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 56 lines 1.3 kB view raw
1{ 2 cmake, 3 fetchFromGitHub, 4 lib, 5 llvmPackages, 6 python ? null, 7 stdenv, 8 swig, 9}: 10 11stdenv.mkDerivation (finalAttrs: { 12 pname = "plfit"; 13 version = "1.0.1"; 14 15 src = fetchFromGitHub { 16 owner = "ntamas"; 17 repo = "plfit"; 18 rev = finalAttrs.version; 19 hash = "sha256-0JrPAq/4yzr7XbxvcnFj8CKmMyZT05PkSdGprNdAsJA="; 20 }; 21 22 postPatch = lib.optionalString (python != null) '' 23 substituteInPlace src/CMakeLists.txt \ 24 --replace-fail ' ''${Python3_SITEARCH}' ' ${placeholder "out"}/${python.sitePackages}' \ 25 --replace-fail ' ''${Python3_SITELIB}' ' ${placeholder "out"}/${python.sitePackages}' 26 ''; 27 28 nativeBuildInputs = [ 29 cmake 30 ] 31 ++ lib.optionals (python != null) [ 32 python 33 swig 34 ]; 35 36 cmakeFlags = [ 37 "-DPLFIT_USE_OPENMP=ON" 38 ] 39 ++ lib.optionals (python != null) [ 40 "-DPLFIT_COMPILE_PYTHON_MODULE=ON" 41 ]; 42 43 buildInputs = lib.optionals stdenv.cc.isClang [ 44 llvmPackages.openmp 45 ]; 46 47 doCheck = true; 48 49 meta = { 50 description = "Fitting power-law distributions to empirical data"; 51 homepage = "https://github.com/ntamas/plfit"; 52 changelog = "https://github.com/ntamas/plfit/blob/${finalAttrs.src.rev}/CHANGELOG.md"; 53 license = lib.licenses.gpl2Plus; 54 maintainers = with lib.maintainers; [ dotlambda ]; 55 }; 56})