feat(teal): beancount: minion: update config

There are various plugins I would like to have for settling up some
expenses from a holiday. Additionally, there are some sensible settings
that I'd like to nail down in nix config.

Change-Id: I344c13e14be5bbdb74118ab162cda2fbc3e7e7fc
Reviewed-on: https://git.clicks.codes/c/Infra/NixFiles/+/861
Reviewed-by: Skyler Grey <minion@clicks.codes>
Tested-by: Skyler Grey <minion@clicks.codes>
diff --git a/packages/beancount-beancount_plugin_utils/default.nix b/packages/beancount-beancount_plugin_utils/default.nix
new file mode 100644
index 0000000..0a89a33
--- /dev/null
+++ b/packages/beancount-beancount_plugin_utils/default.nix
@@ -0,0 +1,34 @@
+{ lib
+, python3
+}: let
+  pname = "beancount_plugin_utils";
+  version = "0.0.4";
+in python3.pkgs.buildPythonApplication {
+  inherit pname version;
+
+  src = python3.pkgs.fetchPypi {
+    inherit pname version;
+    sha256 = "sha256-6deB3v3zzPQkXb8haEOP4KnksKax04SZ+YBLagpad4o=";
+  };
+
+  format = "pyproject";
+
+  propagatedBuildInputs = [
+    python3.pkgs.beancount
+  ];
+
+  buildInputs = [
+    python3.pkgs.setuptools
+    python3.pkgs.pdm-pep517
+  ];
+
+  meta = {
+    homepage = "https://github.com/Akuukis/beancount_plugin_utils";
+    description = ''Utils for beancount plugin writers - BeancountError, mark, metaset, etc.
+
+    Not ready for public use, but used by various Akuukis plugins.
+    Appears unmaintained'';
+    license = lib.licenses.agpl3Only;
+    maintainers = [ lib.maintainers.minion3665 ];
+  };
+}
diff --git a/packages/beancount-beancount_share/default.nix b/packages/beancount-beancount_share/default.nix
new file mode 100644
index 0000000..21c5261
--- /dev/null
+++ b/packages/beancount-beancount_share/default.nix
@@ -0,0 +1,33 @@
+{ lib
+, python3
+, clicks
+}: let
+  pname = "beancount_share";
+  version = "0.1.10";
+in python3.pkgs.buildPythonApplication {
+  inherit pname version;
+
+  src = python3.pkgs.fetchPypi {
+    inherit pname version;
+    sha256 = "sha256-fnbdzijt/kCi4sUxCf2IPkpCjdwz9cZyCOJyQTAKkaY=";
+  };
+
+  format = "pyproject";
+
+  propagatedBuildInputs = [
+    python3.pkgs.beancount
+    clicks.beancount-beancount_plugin_utils
+  ];
+
+  buildInputs = [
+    python3.pkgs.setuptools
+    python3.pkgs.pdm-pep517
+  ];
+
+  meta = {
+    homepage = "https://github.com/Akuukis/beancount_share";
+    description = "A beancount plugin to share expenses with external partners within one ledger.";
+    license = lib.licenses.agpl3Only;
+    maintainers = [ lib.maintainers.minion3665 ];
+  };
+}
diff --git a/systems/x86_64-linux/teal/default.nix b/systems/x86_64-linux/teal/default.nix
index fce4ae1..f3ea080 100644
--- a/systems/x86_64-linux/teal/default.nix
+++ b/systems/x86_64-linux/teal/default.nix
@@ -183,6 +183,7 @@
         enable = true;
         extraPythonPackages = [
           pkgs.clicks.beancount-autobean
+          pkgs.clicks.beancount-beancount_share
           pkgs.clicks.beancount-smart_importer
         ];
         tailscaleAuth = true;
@@ -204,6 +205,7 @@
             favaExtraOptions = {
               invert-income-liabilities-equity = "true";
               auto-reload = "true";
+              fiscal-year-end = "04-05";
               import-config = builtins.toString (pkgs.writeText "minion-imports.py" ''
                 import autobean.truelayer
                 from smart_importer import apply_hooks, PredictPayees, PredictPostings
@@ -229,6 +231,23 @@
               '');
               import-dirs = "/var/lib/private/fava/minion/";
             };
+            extraConfig = ''
+              plugin "fava.plugins.tag_discovered_documents"
+              plugin "fava.plugins.link_documents"
+
+              plugin "beancount.plugins.pedantic"
+              plugin "beancount.plugins.unrealized" "Unrealized"
+              plugin "beancount.plugins.implicit_prices"
+
+              plugin "beancount_share.share" "{
+                  'mark_name': 'share',
+                  'meta_name': 'shared',
+                  'account_debtors': 'Assets:People',
+                  'account_creditors': 'Liabilities:People',
+                  'open_date': '1970-01-01',
+                  'quantize': '0.01'
+              }"
+            '';
           };
           "testing" = lib.home-manager.hm.dag.entryAfter [ "clicks" ] {
             name = "Test Data - May Be Wiped At Any Time";