Maddy service tls config from wiki fails

hey there,
i am really new to nix and nixos and tbh have been struggling.
i am starting to get nix as a package manager but am still truly in the dark on nixos.
i do have a server though running nixos and i was trying to set up maddy with tls as described on the wiki.
for reference:

  # Enable TLS listeners. Configuring this via the module is not yet
  # implemented, see https://github.com/NixOS/nixpkgs/pull/153372
  config = builtins.replaceStrings [
    "imap tcp://0.0.0.0:143"
    "submission tcp://0.0.0.0:587"
  ] [
    "imap tls://0.0.0.0:993 tcp://0.0.0.0:143"
    "submission tls://0.0.0.0:465 tcp://0.0.0.0:587"
  ] options.services.maddy.config.default;

however that fails on option being undefined - makes sense.
however i have no clue of what i should supply instead.

if you can help me figure out what to pass instead that would be really great. i would also very much appreciate some pointers on where my understanding of nixos is wrong, whats actually going on, or how i should approach such a situation

i tried this

  • doing the replace on config.services.maddy.config.default (which would supply the right value i checked with the repl) leads to a recursion error

    • i tried passing it via a variable that i define before (in hope that it would have cloned the data) via a let maddy_base_conf = config.services.maddy.config.default; in { ... } to no avail.
  • then i thought overlays might be the answer and i define one but there i could never access the prev.maddy.config attr - which now also makes sense as that is the package config and not the service config (if i got that correctly)

    • same went for the prev.maddy.overrideAttrs (attrs: { config = stringReplaceOnThe_attrs_varHere} )
      that went where the keys of attrs where:
      GOARCH GOFLAGS GOOS buildInputs buildPhase checkPhase
      configurePhase disallowedReferences doCheck enableParallelBuilding 
      installPhase ldflags meta nativeBuildInputs passthru pname postInstall 
      src strictDeps subPackages tags version
      
  • being really upset

  • looking through the nixos manual for simmilar situations where you (as far as i got the issue) have the configuration itself be overlayed recursively

there was this test file in nixpkgs that also contained the whole options being passed to it as an option but i couldn’t figure out what the analogue would be in the configuration.nix context and also like i think this is the same point as the original quest to find the proper thing to call instead of options but just with the extra step of a function.

Update: never mind apparently everything is fine with the thing from the wiki and somehow i declared incorrectly what was being passed in configuration.nix as an input for the function…

so just doing as the wiki says and having this as the parameter for the configuration.nix worked:

{ config, lib, modulesPath, pkgs, specialArgs, options }: