nixpkgs/pkgs/tools/text/ledger2beancount/default.nix

64 lines
1.5 KiB
Nix
Raw Normal View History

2021-01-15 09:19:50 +00:00
{ lib, stdenv, fetchFromGitHub, makeWrapper, perlPackages, beancount }:
2020-05-21 20:41:08 +00:00
2021-01-15 09:19:50 +00:00
with lib;
2020-05-21 20:41:08 +00:00
let
perlDeps = with perlPackages; [
DateCalc
DateTimeFormatStrptime
enum
FileBaseDir
GetoptLongDescriptive
ListMoreUtils
RegexpCommon
2020-05-21 20:41:08 +00:00
StringInterpolate
YAMLLibYAML
2020-05-21 20:41:08 +00:00
];
in stdenv.mkDerivation rec {
pname = "ledger2beancount";
version = "2.5";
2020-05-21 20:41:08 +00:00
src = fetchFromGitHub {
owner = "beancount";
2020-05-21 20:41:08 +00:00
repo = "ledger2beancount";
rev = version;
sha256 = "0kimp8l9ax37grfv5r5iw0g0xnrpkak022fl10y3i7kc4nyi1s99";
2020-05-21 20:41:08 +00:00
};
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/beancount/ledger2beancount";
2020-05-21 20:41:08 +00:00
license = licenses.gpl3Plus;
platforms = platforms.all;
maintainers = with maintainers; [ pablovsky ];
};
}