l bank: move to own package

This commit is contained in:
lassulus 2019-10-14 15:51:14 +02:00
parent 90ec1376f3
commit 66816ee636
2 changed files with 15 additions and 15 deletions

View File

@ -0,0 +1,14 @@
{ writeDashBin, coreutils, pass, hledger, diffutils }:
writeDashBin "bank" ''
tmp=$(mktemp)
${pass}/bin/pass show hledger > $tmp
${hledger}/bin/hledger --file=$tmp "$@"
${pass}/bin/pass show hledger | if ${diffutils}/bin/diff $tmp -; then
exit 0
else
${coreutils}/bin/cat $tmp | ${pass}/bin/pass insert -m hledger
fi
${coreutils}/bin/rm $tmp
''

View File

@ -19,20 +19,6 @@ self: super: let
mapAttrs (name: _: path + "/${name}") mapAttrs (name: _: path + "/${name}")
(filterAttrs (_: eq "directory") (readDir path)); (filterAttrs (_: eq "directory") (readDir path));
in { in mapAttrs (_: flip callPackage {})
bank = self.writeDashBin "bank" ''
tmp=$(mktemp)
${self.pass}/bin/pass show hledger > $tmp
${self.hledger}/bin/hledger --file=$tmp "$@"
${self.pass}/bin/pass show hledger | if ${self.diffutils}/bin/diff $tmp -; then
exit 0
else
${self.coreutils}/bin/cat $tmp | ${self.pass}/bin/pass insert -m hledger
fi
${self.coreutils}/bin/rm $tmp
'';
}
// mapAttrs (_: flip callPackage {})
(filterAttrs (_: dir: pathExists (dir + "/default.nix")) (filterAttrs (_: dir: pathExists (dir + "/default.nix"))
(subdirsOf ./.)) (subdirsOf ./.))