dotfiles/modules/nixos/services/firefly/default.nix
2025-10-09 03:09:57 -05:00

64 lines
1.3 KiB
Nix
Executable file

{ flake, config, ... }:
let
inherit (flake.config.services.instances) firefly;
inherit (flake.config.machines.devices) ceres;
service = firefly;
in
{
services = {
firefly-iii = {
enable = true;
dataDir = service.paths.path0;
settings = {
DB_CONNECTION = "pgsql";
APP_KEY_FILE = config.sops.secrets."${service.name}-pass".path;
};
};
firefly-iii-data-importer = {
enable = true;
};
};
sops =
let
sopsPath = secret: {
path = "${service.sops.path0}/${service.name}-${secret}";
owner = service.name;
mode = "600";
};
in
{
secrets = builtins.listToAttrs (
map
(secret: {
name = "${service.name}-${secret}";
value = sopsPath secret;
})
[
"pass"
]
);
};
fileSystems."/var/lib/${service.name}" = {
device = service.paths.path0;
fsType = "none";
options = [
"bind"
];
depends = [
ceres.storage0.mount
];
};
systemd.tmpfiles.rules = [
"Z ${service.paths.path0} 755 ${service.name} ${service.name} -"
"Z ${service.sops.path0} 755 ${service.name} ${service.name} -"
];
networking = {
firewall.allowedTCPPorts = [
8080
8081
];
};
}