feat(fava.accounts.minion): Add truelayer importer

Truelayer is a platform that connects to many European financial
institutions, including all the ones I care about! I plan to make this
generic over accounts in the future, but for now it's awesome to have a
proof-of-concept for importers working on a single account...

Change-Id: I1b51da2952a666316a68c4dae913b5cdfae2718a
Reviewed-on: https://git.clicks.codes/c/Infra/NixFiles/+/805
Tested-by: Skyler Grey <minion@clicks.codes>
Reviewed-by: Skyler Grey <minion@clicks.codes>
diff --git a/packages/beancount-autobean/default.nix b/packages/beancount-autobean/default.nix
new file mode 100644
index 0000000..440375f
--- /dev/null
+++ b/packages/beancount-autobean/default.nix
@@ -0,0 +1,38 @@
+{ lib
+, python3
+}: let
+  pname = "autobean";
+  version = "0.2.2";
+in python3.pkgs.buildPythonApplication {
+  inherit pname version;
+
+  src = python3.pkgs.fetchPypi {
+    inherit pname version;
+    sha256 = "sha256-2gN9AyP66r2AwrTWJnRf+9W+TTfylRQkSAEea4tvKko=";
+  };
+
+  format = "pyproject";
+
+  propagatedBuildInputs = [
+    python3.pkgs.beancount
+    python3.pkgs.python-dateutil
+    python3.pkgs.pyyaml
+    python3.pkgs.requests
+  ];
+
+  buildInputs = [
+    python3.pkgs.setuptools
+    python3.pkgs.pdm-pep517
+  ];
+
+  meta = {
+    homepage = "https://github.com/SEIAROTg/autobean";
+    description = "A collection of plugins and scripts that help automating bookkeeping with beancount";
+    license = lib.licenses.gpl2;
+    maintainers = [ lib.maintainers.minion3665 ];
+  };
+
+  patches = [
+    ./skip-empty-account-types.patch
+  ];
+}
diff --git a/packages/beancount-autobean/skip-empty-account-types.patch b/packages/beancount-autobean/skip-empty-account-types.patch
new file mode 100644
index 0000000..eee3807
--- /dev/null
+++ b/packages/beancount-autobean/skip-empty-account-types.patch
@@ -0,0 +1,15 @@
+diff --git a/autobean/truelayer/importer.py b/autobean/truelayer/importer.py
+index 97a651ab91...da5a91d47e 100644
+--- a/autobean/truelayer/importer.py
++++ b/autobean/truelayer/importer.py
+@@ -183,6 +183,9 @@
+     def _fetch_all_transactions(self) -> list[Directive]:
+         entries: list[Directive] = []
+         for type_ in ACCOUNT_TYPES:
++            if not type_ in self._config.data:
++                continue
++
+             for account_id, account in self._config.data[type_].items():
+                 if not account['enabled']:
+                     continue
+
diff --git a/packages/beancount-smart_importer/default.nix b/packages/beancount-smart_importer/default.nix
new file mode 100644
index 0000000..9257137
--- /dev/null
+++ b/packages/beancount-smart_importer/default.nix
@@ -0,0 +1,33 @@
+{ lib
+, python3
+}: let
+  pname = "smart_importer";
+  version = "0.5";
+in python3.pkgs.buildPythonApplication {
+  inherit pname version;
+
+  src = python3.pkgs.fetchPypi {
+    inherit pname version;
+    sha256 = "sha256-n0mBayg3Ny/5eHByonDnqpDeErv3tDhp577cCoM6l1I=";
+  };
+
+  format = "pyproject";
+
+  propagatedBuildInputs = [
+    python3.pkgs.beancount
+    python3.pkgs.scikit-learn
+    python3.pkgs.numpy
+  ];
+
+  buildInputs = [
+    python3.pkgs.setuptools
+    python3.pkgs.setuptools_scm
+  ];
+
+  meta = {
+    homepage = "https://github.com/beancount/smart_importer";
+    description = "Augment Beancount importers with machine learning functionality";
+    license = lib.licenses.mit;
+    maintainers = [ lib.maintainers.minion3665 ];
+  };
+}