mirror of
https://gitlab.com/upRootNutrition/dotfiles.git
synced 2025-08-08 21:04:38 -05:00
feat: firefly-iii test
This commit is contained in:
parent
06a684fa32
commit
981a43b853
4 changed files with 127 additions and 2 deletions
84
modules/nixos/services/firefly/default.nix
Normal file
84
modules/nixos/services/firefly/default.nix
Normal file
|
@ -0,0 +1,84 @@
|
|||
{ flake, config, ... }:
|
||||
let
|
||||
inherit (flake.config.people) user0;
|
||||
inherit (flake.config.services.instances) firefly web;
|
||||
inherit (flake.config.machines.devices) ceres;
|
||||
service = firefly;
|
||||
localhost = web.localhost.address0;
|
||||
host = service.domains.url0;
|
||||
in
|
||||
{
|
||||
services = {
|
||||
firefly-iii = {
|
||||
enable = true;
|
||||
virtualHost = host;
|
||||
settings = {
|
||||
APP_URL = host;
|
||||
APP_KEY_FILE = config.sops.secrets."${service.name}-key".path;
|
||||
SITE_OWNER = user0.email.address0;
|
||||
# DB_PORT = 3306;
|
||||
DB_DATABASE = "firefly";
|
||||
DB_USERNAME = "firefly";
|
||||
DB_PASSWORD_FILE = config.sops.secrets."${service.name}-pass".path;
|
||||
};
|
||||
};
|
||||
caddy = {
|
||||
virtualHosts = {
|
||||
"${host}" = {
|
||||
extraConfig = ''
|
||||
redir /.well-known/carddav /remote.php/dav/ 301
|
||||
redir /.well-known/caldav /remote.php/dav/ 301
|
||||
|
||||
reverse_proxy ${localhost}:${toString service.ports.port0}
|
||||
|
||||
tls ${service.ssl.cert} ${service.ssl.key}
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
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;
|
||||
})
|
||||
[
|
||||
"key"
|
||||
"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 = [
|
||||
service.ports.port0
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue