2021-02-17 04:39:14 +00:00
|
|
|
{ stdenv, lib, fetchFromGitHub, cmake, boost, gmp, mpfr, libedit, python3
|
2023-02-08 04:20:00 +00:00
|
|
|
, installShellFiles, texinfo, gnused, usePython ? false }:
|
2011-07-20 22:56:39 +00:00
|
|
|
|
2017-08-31 03:51:10 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "ledger";
|
2023-02-08 04:20:00 +00:00
|
|
|
version = "3.3.0";
|
2011-07-20 22:56:39 +00:00
|
|
|
|
2017-08-31 03:51:10 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ledger";
|
|
|
|
repo = "ledger";
|
2019-03-31 16:39:41 +00:00
|
|
|
rev = "v${version}";
|
2023-02-08 04:20:00 +00:00
|
|
|
hash = "sha256-0hN6Hpmgwb3naV2K1fxX0OyH0IyCQAh1nZ9TMNAutic=";
|
2011-07-20 22:56:39 +00:00
|
|
|
};
|
|
|
|
|
2023-02-08 04:20:00 +00:00
|
|
|
outputs = [ "out" "dev" ] ++ lib.optionals usePython [ "py" ];
|
2020-08-02 00:25:55 +00:00
|
|
|
|
2018-07-01 17:32:50 +00:00
|
|
|
buildInputs = [
|
2022-04-22 17:27:12 +00:00
|
|
|
gmp mpfr libedit gnused
|
2023-02-08 04:20:00 +00:00
|
|
|
] ++ (if usePython
|
|
|
|
then [ python3 (boost.override { enablePython = true; python = python3; }) ]
|
|
|
|
else [ boost ]);
|
2017-08-31 03:51:10 +00:00
|
|
|
|
2022-05-08 04:20:00 +00:00
|
|
|
nativeBuildInputs = [ cmake texinfo installShellFiles ];
|
2011-07-20 22:56:39 +00:00
|
|
|
|
2018-12-21 20:36:29 +00:00
|
|
|
cmakeFlags = [
|
|
|
|
"-DCMAKE_INSTALL_LIBDIR=lib"
|
|
|
|
"-DBUILD_DOCS:BOOL=ON"
|
2023-02-08 04:20:00 +00:00
|
|
|
"-DUSE_PYTHON:BOOL=${if usePython then "ON" else "OFF"}"
|
2020-08-02 00:25:55 +00:00
|
|
|
];
|
2018-12-21 20:36:29 +00:00
|
|
|
|
2020-08-02 00:25:55 +00:00
|
|
|
# by default, it will query the python interpreter for it's sitepackages location
|
|
|
|
# however, that would write to a different nixstore path, pass our own sitePackages location
|
|
|
|
prePatch = lib.optionalString usePython ''
|
|
|
|
substituteInPlace src/CMakeLists.txt \
|
2022-05-19 04:20:00 +00:00
|
|
|
--replace 'DESTINATION ''${Python_SITEARCH}' 'DESTINATION "${placeholder "py"}/${python3.sitePackages}"'
|
2018-12-21 20:36:29 +00:00
|
|
|
'';
|
2016-09-07 22:03:50 +00:00
|
|
|
|
2020-08-02 00:25:55 +00:00
|
|
|
installTargets = [ "doc" "install" ];
|
|
|
|
|
2022-05-08 04:20:00 +00:00
|
|
|
postInstall = ''
|
|
|
|
installShellCompletion --cmd ledger --bash $src/contrib/ledger-completion.bash
|
|
|
|
'';
|
|
|
|
|
2020-08-02 00:25:55 +00:00
|
|
|
meta = with lib; {
|
2011-07-20 22:56:39 +00:00
|
|
|
description = "A double-entry accounting system with a command-line reporting interface";
|
2023-02-08 04:20:00 +00:00
|
|
|
homepage = "https://www.ledger-cli.org/";
|
|
|
|
changelog = "https://github.com/ledger/ledger/raw/v${version}/NEWS.md";
|
2017-08-31 03:51:10 +00:00
|
|
|
license = licenses.bsd3;
|
2011-07-20 22:56:39 +00:00
|
|
|
longDescription = ''
|
|
|
|
Ledger is a powerful, double-entry accounting system that is accessed
|
|
|
|
from the UNIX command-line. This may put off some users, as there is
|
|
|
|
no flashy UI, but for those who want unparalleled reporting access to
|
|
|
|
their data, there really is no alternative.
|
|
|
|
'';
|
2017-08-31 03:51:10 +00:00
|
|
|
platforms = platforms.all;
|
2022-05-08 04:20:00 +00:00
|
|
|
maintainers = with maintainers; [ jwiegley marsam ];
|
2011-07-20 22:56:39 +00:00
|
|
|
};
|
|
|
|
}
|