summary refs log tree commit diff
diff options
context:
space:
mode:
authordavidak <davidak@users.noreply.github.com>2022-05-11 03:37:58 +0200
committerGitHub <noreply@github.com>2022-05-11 03:37:58 +0200
commitb135d3b2234b80c6fb20107121093e18c0a09df7 (patch)
tree9f51c8c51f98f54fc3e5621ec7c2cd3c02ac073d
parent547f9bf973df9eaba3941cc19d0d149607cd6445 (diff)
parent9d22c5a51a07463869c48dba88013b4bca62e9b7 (diff)
downloadnixpkgs-b135d3b2234b80c6fb20107121093e18c0a09df7.tar
nixpkgs-b135d3b2234b80c6fb20107121093e18c0a09df7.tar.gz
nixpkgs-b135d3b2234b80c6fb20107121093e18c0a09df7.tar.bz2
nixpkgs-b135d3b2234b80c6fb20107121093e18c0a09df7.tar.lz
nixpkgs-b135d3b2234b80c6fb20107121093e18c0a09df7.tar.xz
nixpkgs-b135d3b2234b80c6fb20107121093e18c0a09df7.tar.zst
nixpkgs-b135d3b2234b80c6fb20107121093e18c0a09df7.zip
Merge pull request #172116 from marsam/ledger-completions
ledger: install completions
-rw-r--r--pkgs/applications/office/ledger/default.nix19
1 files changed, 16 insertions, 3 deletions
diff --git a/pkgs/applications/office/ledger/default.nix b/pkgs/applications/office/ledger/default.nix
index 0ea9b908ada..83c47848bc4 100644
--- a/pkgs/applications/office/ledger/default.nix
+++ b/pkgs/applications/office/ledger/default.nix
@@ -1,5 +1,5 @@
 { stdenv, lib, fetchFromGitHub, cmake, boost, gmp, mpfr, libedit, python3
-, texinfo, gnused, usePython ? true }:
+, fetchpatch, installShellFiles, texinfo, gnused, usePython ? true }:
 
 stdenv.mkDerivation rec {
   pname = "ledger";
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
     gmp mpfr libedit gnused
   ] ++ lib.optional usePython python3;
 
-  nativeBuildInputs = [ cmake texinfo ];
+  nativeBuildInputs = [ cmake texinfo installShellFiles ];
 
   cmakeFlags = [
     "-DCMAKE_INSTALL_LIBDIR=lib"
@@ -34,8 +34,21 @@ stdenv.mkDerivation rec {
       --replace 'DESTINATION ''${Python_SITEARCH}' 'DESTINATION "${python3.sitePackages}"'
   '';
 
+  patches = [
+    # Add support for $XDG_CONFIG_HOME. Remove with the next release
+    (fetchpatch {
+      url = "https://github.com/ledger/ledger/commit/c79674649dee7577d6061e3d0776922257520fd0.patch";
+      sha256 = "sha256-vwVQnY9EUCXPzhDJ4PSOmQStb9eF6H0yAOiEmL6sAlk=";
+      excludes = [ "doc/NEWS.md" ];
+    })
+  ];
+
   installTargets = [ "doc" "install" ];
 
+  postInstall = ''
+    installShellCompletion --cmd ledger --bash $src/contrib/ledger-completion.bash
+  '';
+
   meta = with lib; {
     homepage = "https://ledger-cli.org/";
     description = "A double-entry accounting system with a command-line reporting interface";
@@ -49,6 +62,6 @@ stdenv.mkDerivation rec {
     '';
 
     platforms = platforms.all;
-    maintainers = with maintainers; [ jwiegley ];
+    maintainers = with maintainers; [ jwiegley marsam ];
   };
 }