rework actual-budget to be more generic with test

This commit is contained in:
2025-07-30 17:28:23 +07:00
parent bfd0dd1a41
commit c5c8e0050d
6 changed files with 101 additions and 40 deletions

View File

@@ -1,4 +1,4 @@
{ lib, ... }:
{ ... }:
{
_class = "clan.service";
manifest.name = "actual-budget";
@@ -6,49 +6,21 @@
manifest.categories = [ "System" ];
roles.default = {
interface.options = {
domain = lib.mkOption {
type = lib.types.str;
default = "budget";
description = "Sub domain for Actual Budget.";
};
};
perInstance =
perInstance.nixosModule =
{
settings,
lib,
config,
...
}:
{
nixosModule =
{
config,
...
}:
let
domain = "${settings.domain}.${config.networking.fqdn}";
in
{
services.actual = {
enable = true;
openFirewall = true;
settings = {
port = 5006;
allowedLoginMethods = [
"password"
"openid"
];
trustedProxies = [ "127.0.0.1" ];
};
};
services.nginx.virtualHosts."${domain}" = {
forceSSL = true;
useACMEHost = "${config.networking.fqdn}";
locations."/" = {
proxyPass = "http://localhost:${builtins.toString config.services.actual.settings.port}";
};
};
};
services.actual = {
enable = lib.mkDefault true;
};
clan.core.state.actual-budget.folders = [
config.systemd.services.actual.serviceConfig.WorkingDirectory
];
};
};
}