installed actual on defiant
This commit is contained in:
parent
102a61b38e
commit
d12f4b5327
4 changed files with 75 additions and 0 deletions
54
modules/nixos-modules/server/actual.nix
Normal file
54
modules/nixos-modules/server/actual.nix
Normal file
|
@ -0,0 +1,54 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
dataDirectory = "/var/lib/actual/";
|
||||
in {
|
||||
options.services.actual = {
|
||||
subdomain = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "actual";
|
||||
description = "subdomain of base domain that actual will be hosted at";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf config.services.actual.enable (lib.mkMerge [
|
||||
{
|
||||
systemd.tmpfiles.rules = [
|
||||
"d ${dataDirectory} 2770 actual actual"
|
||||
];
|
||||
host = {
|
||||
reverse_proxy.subdomains.${config.services.actual.subdomain} = {
|
||||
target = "http://localhost:${toString config.services.actual.settings.port}";
|
||||
};
|
||||
};
|
||||
|
||||
services.actual = {
|
||||
settings = {
|
||||
ACTUAL_DATA_DIR = dataDirectory;
|
||||
};
|
||||
};
|
||||
}
|
||||
(lib.mkIf config.services.fail2ban.enable {
|
||||
# TODO: configuration for fail2ban for actual
|
||||
})
|
||||
(lib.mkIf config.host.impermanence.enable {
|
||||
assertions = [
|
||||
{
|
||||
assertion = config.services.actual.settings.ACTUAL_DATA_DIR == dataDirectory;
|
||||
message = "actual data location does not match persistence";
|
||||
}
|
||||
];
|
||||
environment.persistence."/persist/system/root" = {
|
||||
directories = [
|
||||
{
|
||||
directory = dataDirectory;
|
||||
user = "actual";
|
||||
group = "actual";
|
||||
}
|
||||
];
|
||||
};
|
||||
})
|
||||
]);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue