feat(fava): Specify default-file in options
I made a patch for fava, open at https://github.com/beancount/fava/pull/1833,
which makes default files able to be specified as an argument rather
than by placing the default-file directive in the default file. This is
a lot cleaner for us, as this was the only line that we needed to inject
into our newly-created ledgers
Additionally, this patch makes default files be the target for added
entries, which allows us to use the "+" button and will also be required
for importers, both of which previously attempted to insert entries in
the read-only settings file
Change-Id: I49dd803941d8c855eeecb274bd4973a42283c17f
Reviewed-on: https://git.clicks.codes/c/Infra/NixFiles/+/804
Reviewed-by: Skyler Grey <minion@clicks.codes>
Tested-by: Skyler Grey <minion@clicks.codes>
diff --git a/modules/nixos/clicks/services/fava/default.nix b/modules/nixos/clicks/services/fava/default.nix
index fb707fd..73cab36 100644
--- a/modules/nixos/clicks/services/fava/default.nix
+++ b/modules/nixos/clicks/services/fava/default.nix
@@ -42,7 +42,6 @@
example = {
invert-income-liabilities-equity = true;
};
- default = {};
};
beancountExtraOptions = lib.mkOption {
type = lib.types.attrsOf lib.types.str;
@@ -75,6 +74,7 @@
};
config = {
beancountExtraOptions.title = lib.mkDefault submodule.config.name;
+ favaExtraOptions.default-file = lib.mkDefault submodule.config.mainFile;
configFile = builtins.toString (let
generateFavaOption = name: value:
@@ -171,7 +171,7 @@
in ''
${pkgs.coreutils}/bin/mkdir -p "$(${pkgs.coreutils}/bin/dirname "${data.mainFile}")"
if [ ! -f "${data.mainFile}" ]; then
- ${pkgs.coreutils}/bin/echo '1970-01-01 custom "fava-option" "default-file"' >> ${data.mainFile}
+ touch ${data.mainFile}
fi
'';