2023-02-16 17:41:37 +00:00
|
|
|
{ stdenv, lib, fetchFromGitHub, cmake, boost, gmp, mpfr, libedit, python3, gpgme
|
|
|
|
, installShellFiles, texinfo, gnused, usePython ? false, gpgmeSupport ? false }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "ledger";
|
2023-04-12 12:48:02 +00:00
|
|
|
version = "3.3.2";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ledger";
|
|
|
|
repo = "ledger";
|
|
|
|
rev = "v${version}";
|
2023-04-12 12:48:02 +00:00
|
|
|
hash = "sha256-Uym4s8EyzXHlISZqThcb6P1H5bdgD9vmdIOLkk5ikG0=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-02-16 17:41:37 +00:00
|
|
|
outputs = [ "out" "dev" ] ++ lib.optionals usePython [ "py" ];
|
2020-08-20 17:08:02 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
buildInputs = [
|
2022-04-27 09:35:20 +00:00
|
|
|
gmp mpfr libedit gnused
|
2023-02-16 17:41:37 +00:00
|
|
|
] ++ lib.optionals gpgmeSupport [
|
|
|
|
gpgme
|
|
|
|
] ++ (if usePython
|
|
|
|
then [ python3 (boost.override { enablePython = true; python = python3; }) ]
|
|
|
|
else [ boost ]);
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
nativeBuildInputs = [ cmake texinfo installShellFiles ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DCMAKE_INSTALL_LIBDIR=lib"
|
|
|
|
"-DBUILD_DOCS:BOOL=ON"
|
2023-02-16 17:41:37 +00:00
|
|
|
"-DUSE_PYTHON:BOOL=${if usePython then "ON" else "OFF"}"
|
|
|
|
"-DUSE_GPGME:BOOL=${if gpgmeSupport then "ON" else "OFF"}"
|
2020-08-20 17:08:02 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-08-20 17:08:02 +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-06-16 17:23:12 +00:00
|
|
|
--replace 'DESTINATION ''${Python_SITEARCH}' 'DESTINATION "${placeholder "py"}/${python3.sitePackages}"'
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
installTargets = [ "doc" "install" ];
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
postInstall = ''
|
|
|
|
installShellCompletion --cmd ledger --bash $src/contrib/ledger-completion.bash
|
|
|
|
'';
|
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Double-entry accounting system with a command-line reporting interface";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "ledger";
|
2023-02-16 17:41:37 +00:00
|
|
|
homepage = "https://www.ledger-cli.org/";
|
|
|
|
changelog = "https://github.com/ledger/ledger/raw/v${version}/NEWS.md";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.bsd3;
|
|
|
|
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.
|
|
|
|
'';
|
|
|
|
platforms = platforms.all;
|
2024-05-15 15:35:15 +00:00
|
|
|
maintainers = with maintainers; [ jwiegley ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|