nixos/omnom: fix module
This commit is contained in:
parent
4e519da89e
commit
19c1b4250c
@ -104,14 +104,6 @@ in
|
|||||||
default = "fs";
|
default = "fs";
|
||||||
description = "Storage type.";
|
description = "Storage type.";
|
||||||
};
|
};
|
||||||
root = lib.mkOption {
|
|
||||||
type = lib.types.path;
|
|
||||||
default = "${cfg.dataDir}/static/data";
|
|
||||||
defaultText = lib.literalExpression ''
|
|
||||||
"''${config.services.omnom.dataDir}/static/data"
|
|
||||||
'';
|
|
||||||
description = "Where the snapshots are saved.";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
smtp = {
|
smtp = {
|
||||||
tls = lib.mkEnableOption "Whether TLS encryption should be used.";
|
tls = lib.mkEnableOption "Whether TLS encryption should be used.";
|
||||||
@ -142,6 +134,24 @@ in
|
|||||||
description = "Connection timeout duration in seconds.";
|
description = "Connection timeout duration in seconds.";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
activitypub = {
|
||||||
|
pubkey = lib.mkOption {
|
||||||
|
type = lib.types.path;
|
||||||
|
default = "${cfg.dataDir}/public.pem";
|
||||||
|
defaultText = lib.literalExpression ''
|
||||||
|
"''${config.services.omnom.dataDir}/public.pem"
|
||||||
|
'';
|
||||||
|
description = "ActivityPub public key. Will be generated, by default.";
|
||||||
|
};
|
||||||
|
privkey = lib.mkOption {
|
||||||
|
type = lib.types.path;
|
||||||
|
default = "${cfg.dataDir}/private.pem";
|
||||||
|
defaultText = lib.literalExpression ''
|
||||||
|
"''${config.services.omnom.dataDir}/private.pem"
|
||||||
|
'';
|
||||||
|
description = "ActivityPub private key. Will be generated, by default.";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
default = { };
|
default = { };
|
||||||
@ -150,6 +160,13 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
|
services.omnom = {
|
||||||
|
settings.app = {
|
||||||
|
static_dir = "${cfg.dataDir}/static";
|
||||||
|
template_dir = "${cfg.package}/share/templates";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
assertions = [
|
assertions = [
|
||||||
{
|
{
|
||||||
assertion = !lib.hasAttr "password" cfg.settings.smtp;
|
assertion = !lib.hasAttr "password" cfg.settings.smtp;
|
||||||
@ -157,16 +174,6 @@ in
|
|||||||
`services.omnom.settings.smtp.password` must be defined in `services.omnom.passwordFile`.
|
`services.omnom.settings.smtp.password` must be defined in `services.omnom.passwordFile`.
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
{
|
|
||||||
assertion = !(cfg.settings.storage.root != "${cfg.dataDir}/static/data");
|
|
||||||
message = ''
|
|
||||||
For Omnom to access the snapshots, it needs the storage root
|
|
||||||
directory to be inside the service's working directory.
|
|
||||||
|
|
||||||
As such, `services.omnom.settings.storage.root` must be the same as
|
|
||||||
`''${services.omnom.dataDir}/static/data`.
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
|
|
||||||
systemd.services.omnom = {
|
systemd.services.omnom = {
|
||||||
@ -224,10 +231,10 @@ in
|
|||||||
in
|
in
|
||||||
{
|
{
|
||||||
"${cfg.dataDir}"."d" = settings;
|
"${cfg.dataDir}"."d" = settings;
|
||||||
"${cfg.dataDir}/templates"."L+" = settings // {
|
"${cfg.settings.app.static_dir}"."C" = settings // {
|
||||||
argument = "${cfg.package}/share/templates";
|
argument = "${cfg.package}/share/static";
|
||||||
};
|
};
|
||||||
"${cfg.settings.storage.root}"."d" = settings;
|
"${cfg.settings.app.static_dir}/data"."d" = settings;
|
||||||
};
|
};
|
||||||
|
|
||||||
networking.firewall = lib.mkIf cfg.openFirewall {
|
networking.firewall = lib.mkIf cfg.openFirewall {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user