about summary refs log tree commit diff
path: root/pkgs/by-name/le
diff options
context:
space:
mode:
authorMario Rodas <marsam@users.noreply.github.com>2023-12-23 07:32:28 -0500
committerGitHub <noreply@github.com>2023-12-23 07:32:28 -0500
commitf657c125878182dd14b412d935ae53721ee5de6e (patch)
tree36f2865db9a89a3ccb9a5f09da1f44a6b1462040 /pkgs/by-name/le
parent347bfcbd4a2c5c9c833de7385d0ae7a0f6bd9494 (diff)
parent61259072aa24bd29cd6ee133dd48354de1257223 (diff)
Merge pull request #270129 from afh/ledger-by-name
ledger: migrate to by-name
Diffstat (limited to 'pkgs/by-name/le')
-rw-r--r--pkgs/by-name/le/ledger/package.nix61
1 files changed, 61 insertions, 0 deletions
diff --git a/pkgs/by-name/le/ledger/package.nix b/pkgs/by-name/le/ledger/package.nix
new file mode 100644
index 0000000000000..2e8336660be7b
--- /dev/null
+++ b/pkgs/by-name/le/ledger/package.nix
@@ -0,0 +1,61 @@
+{ stdenv, lib, fetchFromGitHub, cmake, boost, gmp, mpfr, libedit, python3, gpgme
+, installShellFiles, texinfo, gnused, usePython ? false, gpgmeSupport ? false }:
+
+stdenv.mkDerivation rec {
+  pname = "ledger";
+  version = "3.3.2";
+
+  src = fetchFromGitHub {
+    owner  = "ledger";
+    repo   = "ledger";
+    rev    = "v${version}";
+    hash   = "sha256-Uym4s8EyzXHlISZqThcb6P1H5bdgD9vmdIOLkk5ikG0=";
+  };
+
+  outputs = [ "out" "dev" ] ++ lib.optionals usePython [ "py" ];
+
+  buildInputs = [
+    gmp mpfr libedit gnused
+  ] ++ lib.optionals gpgmeSupport [
+    gpgme
+  ] ++ (if usePython
+        then [ python3 (boost.override { enablePython = true; python = python3; }) ]
+        else [ boost ]);
+
+  nativeBuildInputs = [ cmake texinfo installShellFiles ];
+
+  cmakeFlags = [
+    "-DCMAKE_INSTALL_LIBDIR=lib"
+    "-DBUILD_DOCS:BOOL=ON"
+    "-DUSE_PYTHON:BOOL=${if usePython then "ON" else "OFF"}"
+    "-DUSE_GPGME:BOOL=${if gpgmeSupport then "ON" else "OFF"}"
+  ];
+
+  # 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 \
+      --replace 'DESTINATION ''${Python_SITEARCH}' 'DESTINATION "${placeholder "py"}/${python3.sitePackages}"'
+  '';
+
+  installTargets = [ "doc" "install" ];
+
+  postInstall = ''
+    installShellCompletion --cmd ledger --bash $src/contrib/ledger-completion.bash
+  '';
+
+  meta = with lib; {
+    description = "A double-entry accounting system with a command-line reporting interface";
+    homepage = "https://www.ledger-cli.org/";
+    changelog = "https://github.com/ledger/ledger/raw/v${version}/NEWS.md";
+    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;
+    maintainers = with maintainers; [ jwiegley marsam ];
+  };
+}