This repository has been archived on 2026-08-30. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
dotfiles/modules/services/actualbudget.nix

116 lines
2.7 KiB
Nix

{
config,
lib,
my,
...
}:
let
cfg = config.modules.services.actualbudget;
rp = cfg.reverseProxy;
in
{
options.modules.services.actualbudget = {
enable = lib.mkEnableOption "Actual Budget";
port = lib.mkOption {
type = lib.types.port;
default = 5006;
description = "Port Actual Budget listens on.";
};
dataDir = lib.mkOption {
type = lib.types.str;
default = "/data";
description = "Directory where Actual Budget stores server and user files.";
};
user = lib.mkOption {
type = lib.types.str;
default = "actual";
description = "User account that runs Actual Budget.";
};
uid = lib.mkOption {
type = lib.types.ints.positive;
default = my.serviceUid "actualbudget";
description = "Stable uid for the Actual Budget service user.";
};
group = lib.mkOption {
type = lib.types.str;
default = "storage";
description = "Group account that owns Actual Budget's writable state.";
};
reverseProxy = {
enable = lib.mkEnableOption "the public reverse-proxy route for Actual Budget";
host = lib.mkOption {
type = lib.types.str;
description = "Primary hostname served by the Actual Budget route.";
};
aliases = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
description = "Additional hostnames served by the Actual Budget route.";
};
path = lib.mkOption {
type = lib.types.str;
default = "/";
description = "URL path prefix proxied to Actual Budget.";
};
backend = lib.mkOption {
type = lib.types.str;
description = "Full HTTP backend URL for the Actual Budget service.";
};
tls = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Whether to serve Actual Budget with ACME-backed TLS.";
};
websockets = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Whether to enable websocket proxying for Actual Budget.";
};
};
};
config = lib.mkMerge [
(lib.mkIf rp.enable {
modules.reverse-proxy.routes.actualbudget = {
inherit (rp)
host
aliases
path
backend
tls
websockets
;
};
})
(lib.mkIf cfg.enable {
users.users.${cfg.user} = {
isSystemUser = true;
uid = cfg.uid;
group = cfg.group;
};
services.actual = {
enable = true;
openFirewall = true;
user = cfg.user;
group = cfg.group;
settings = {
inherit (cfg) port dataDir;
};
};
})
];
}