2021-01-15 10:19:50 +01:00
|
|
|
{ lib, stdenv, fetchFromGitHub, makeWrapper, perlPackages, beancount }:
|
2020-05-21 22:41:08 +02:00
|
|
|
|
2021-01-15 10:19:50 +01:00
|
|
|
with lib;
|
2020-05-21 22:41:08 +02:00
|
|
|
|
|
|
|
let
|
|
|
|
perlDeps = with perlPackages; [
|
2021-02-16 04:14:11 +01:00
|
|
|
DateCalc
|
|
|
|
DateTimeFormatStrptime
|
|
|
|
enum
|
|
|
|
FileBaseDir
|
|
|
|
GetoptLongDescriptive
|
|
|
|
ListMoreUtils
|
|
|
|
RegexpCommon
|
2020-05-21 22:41:08 +02:00
|
|
|
StringInterpolate
|
2021-02-16 04:14:11 +01:00
|
|
|
YAMLLibYAML
|
2020-05-21 22:41:08 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
pname = "ledger2beancount";
|
2021-07-28 09:57:34 +02:00
|
|
|
version = "2.6";
|
2020-05-21 22:41:08 +02:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2021-02-16 04:14:11 +01:00
|
|
|
owner = "beancount";
|
2020-05-21 22:41:08 +02:00
|
|
|
repo = "ledger2beancount";
|
2020-11-01 23:39:49 +01:00
|
|
|
rev = version;
|
2021-07-28 09:57:34 +02:00
|
|
|
sha256 = "sha256-0Br+zuSUYrNP+ZL/FtNoaYoYBYho5kVfxu0tqKJSuBk=";
|
2020-05-21 22:41:08 +02:00
|
|
|
};
|
|
|
|
|
2021-07-20 12:01:25 +02:00
|
|
|
dontBuild = true;
|
2020-05-21 22:41:08 +02:00
|
|
|
|
|
|
|
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.
|
|
|
|
'';
|
2021-02-16 04:14:11 +01:00
|
|
|
homepage = "https://github.com/beancount/ledger2beancount";
|
2020-05-21 22:41:08 +02:00
|
|
|
license = licenses.gpl3Plus;
|
|
|
|
platforms = platforms.all;
|
|
|
|
maintainers = with maintainers; [ pablovsky ];
|
|
|
|
};
|
|
|
|
}
|