From 19c1b4250cdca84b18e66187e9e567c2729c5a5e Mon Sep 17 00:00:00 2001 From: eljamm Date: Tue, 20 May 2025 21:02:36 +0200 Subject: [PATCH] nixos/omnom: fix module --- nixos/modules/services/misc/omnom.nix | 49 +++++++++++++++------------ 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/nixos/modules/services/misc/omnom.nix b/nixos/modules/services/misc/omnom.nix index da21648105e3..6e157ca3b014 100644 --- a/nixos/modules/services/misc/omnom.nix +++ b/nixos/modules/services/misc/omnom.nix @@ -104,14 +104,6 @@ in default = "fs"; 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 = { tls = lib.mkEnableOption "Whether TLS encryption should be used."; @@ -142,6 +134,24 @@ in 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 = { }; @@ -150,6 +160,13 @@ in }; config = lib.mkIf cfg.enable { + services.omnom = { + settings.app = { + static_dir = "${cfg.dataDir}/static"; + template_dir = "${cfg.package}/share/templates"; + }; + }; + assertions = [ { assertion = !lib.hasAttr "password" cfg.settings.smtp; @@ -157,16 +174,6 @@ in `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 = { @@ -224,10 +231,10 @@ in in { "${cfg.dataDir}"."d" = settings; - "${cfg.dataDir}/templates"."L+" = settings // { - argument = "${cfg.package}/share/templates"; + "${cfg.settings.app.static_dir}"."C" = settings // { + 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 {