about summary refs log tree commit diff
path: root/pkgs/tools/text/ledger2beancount
diff options
context:
space:
mode:
authorpablo1107 <dealberapablo07@gmail.com>2020-05-21 17:41:08 -0300
committerPablo Andres Dealbera <pdealbera@auntap.com>2020-10-30 14:58:29 -0300
commitc268484e05e4dc8c74f3ed02ec110b91a0823acb (patch)
tree6272f9bb03288e0482c759971a759f09a63cea64 /pkgs/tools/text/ledger2beancount
parent6928309c5147b4b2579f0a25d78cd81bcaa4e38b (diff)
ledger2beancount: init at 2.1
Diffstat (limited to 'pkgs/tools/text/ledger2beancount')
-rw-r--r--pkgs/tools/text/ledger2beancount/default.nix58
1 files changed, 58 insertions, 0 deletions
diff --git a/pkgs/tools/text/ledger2beancount/default.nix b/pkgs/tools/text/ledger2beancount/default.nix
new file mode 100644
index 0000000000000..00cc996ed60c0
--- /dev/null
+++ b/pkgs/tools/text/ledger2beancount/default.nix
@@ -0,0 +1,58 @@
+{ stdenv, fetchFromGitHub, makeWrapper, perlPackages, beancount }:
+
+with stdenv.lib;
+
+let
+  perlDeps = with perlPackages; [
+    ConfigOnion DateCalc
+    FileBaseDir YAMLLibYAML
+    GetoptLongDescriptive DateTimeFormatStrptime
+    StringInterpolate
+  ];
+
+in stdenv.mkDerivation rec {
+  pname = "ledger2beancount";
+  version = "2.1";
+
+  src = fetchFromGitHub {
+    owner = "zacchiro";
+    repo = "ledger2beancount";
+    rev = "${version}";
+    sha256 = "0w88jb1x0w02jwwf6ipx3cxr89kzffrrdqws3556zrvvs01bh84j";
+  };
+
+  phases = [
+    "unpackPhase"
+    "installPhase"
+    "fixupPhase"
+  ];
+
+  nativeBuildInputs = [ makeWrapper ];
+  buildInputs = [ perlPackages.perl beancount ] ++ perlDeps;
+
+  makeFlags = [ "prefix=$(out)" ];
+  installFlags = [ "INSTALL=install" ];
+
+  installPhase = ''
+    mkdir -p $out
+    cp -r $src/bin $out/bin
+  '';
+
+  postFixup = ''
+    wrapProgram "$out/bin/ledger2beancount" \
+      --set PERL5LIB "${perlPackages.makeFullPerlPath perlDeps}"
+  '';
+
+  meta = {
+    description = "Ledger to Beancount text-based converter";
+    longDescription = ''
+      A script to automatically convert Ledger-based textual ledgers to Beancount ones.
+
+      Conversion is based on (concrete) syntax, so that information that is not meaningful for accounting reasons but still valuable (e.g., comments, formatting, etc.) can be preserved.
+    '';
+    homepage = "https://github.com/zacchiro/ledger2beancount";
+    license = licenses.gpl3Plus;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ pablovsky ];
+  };
+}