self: { config, pkgs, lib, system, ... }: let cfg = config.programs.actual-importer; appConfig = (pkgs.formats.yaml {}).generate "actual-importer.config.yaml" cfg.config; app = pkgs.writeShellApplication { name = "actual-importer"; runtimeInputs = [self.packages.${system}.default]; text = '' actual-importer -c "${appConfig}" "$@"; ''; }; in with lib; { options.programs.actual-importer = { enable = mkEnableOption "actual-importer"; config = mkOption { type = types.attrs; description = "The actual-importer config which will be eventually converted to yaml"; example = { defaultProfile = "my-bank"; profiles = { my-bank = { parser = "pl.ing"; encoding = "utf8"; }; }; defaultServer = "main-server"; servers = { mainServer = { url = "https://my-server.com"; budget = "db353760-33d5-4a2a-ab73-5070a6863fe5"; account = "60b953ad-ce6c-4427-b727-bf37b4b6dd1b"; password = "$__file:/etc/passwords/actual.key"; data = "/tmp/actual"; }; }; }; }; }; config = mkIf cfg.enable { environment.systemPackages = [app]; }; }