Change:
I wanted to configure caddy with my own config file, setting as documented in the option. Steps to reproduce the behavior: above snippet how caddy does not start, as does not exist. at the filesystem, observe there's a directory with a inside, while sets Possibly introduced in Add a :+1: [reaction] to [issues you find important]. [reaction]: [issues you find important]:
Looks like a regression to me. Will investigate further. Thanks for your report and the commit you suggested that might have introduced it :)
I don't think it's that commit. Can you try ?
I am pretty sure this documentation error has been introduced all the way back in . The option docs simply switched from to , but forgot to wrap add a at the end. And now we are somewhat stuck with behavior that expects it that way... sigh.
I think this in combination with introduced the breaking change, since we now always pass as the arg, but expect a basename of to enable the adapter.
It works if you do as demonstrated here: But it's ugly.
Alternatively do and explicitly set .
I tried with too, it doesn't work. I extended with an example (at least I think I did), and it fails. It's pushed to , if someone does a PR fixing the issue feel free to cherry-pick it in ;-)
With you also need to explicitly set .
Fixed it in (when using )
Can you also fix the writeTextDir case? That's what the documentation recommends to use...
I adjusted the documentation to use (which it used to be before )
I could also instead fix the case, if you have strong opinions, but this was a bit easier.
I think fixing the writeTextDir case makes more sense. That's what people might have in their configs, and getting everyone to notice they now need to write it like this, and update configs is worse UX than fixing the usage that was documented. Assuming it worked with 23.05 for example, but regressed with 23.11 again. That is, if this ever worked like this before. If it was broken all the time, no one could have a working config so it doesn't matter much :laughing:
Both and (without ) have been broken since , which landed in .
Ok, in that case, it's been broken for an entire release, so this is not just a regression when upgrading to 23.11. then it's probably ok.

Discussion:
default = configFile; defaultText = "A Caddyfile automatically generated by values from services.caddy.*"; example = literalExpression '' <del> pkgs.writeTextDir "Caddyfile" ''' </del> <ins> pkgs.writeText "Caddyfile" ''' </ins> example.com root * /var/www/wordpress

}; adapter = mkOption { <del> default = if (builtins.baseNameOf cfg.configFile) == "Caddyfile" then "caddyfile" else null; </del> <ins> default = if ((cfg.configFile != configFile) || (builtins.baseNameOf cfg.configFile) == "Caddyfile") then "caddyfile" else null; </ins> defaultText = literalExpression '' <del> if (builtins.baseNameOf cfg.configFile) == "Caddyfile" then "caddyfile" else null </del> <ins> if ((cfg.configFile != configFile) || (builtins.baseNameOf cfg.configFile) == "Caddyfile") then "caddyfile" else null </ins> ''; example = literalExpression "nginx"; type = with types; nullOr str;

}; }; }; <ins> specialisation.explicit-config-file.configuration = { services.caddy.configFile = pkgs.writeText "Caddyfile" '' localhost:80 respond "hello world" ''; }; </ins> }; }; testScript = { nodes, ... }: let <ins> explicitConfigFile = "${nodes.webserver.system.build.toplevel}/specialisation/explicit-config-file"; </ins> justReloadSystem = "${nodes.webserver.system.build.toplevel}/specialisation/config-reload"; multipleConfigs = "${nodes.webserver.system.build.toplevel}/specialisation/multiple-configs"; rfc42Config = "${nodes.webserver.system.build.toplevel}/specialisation/rfc42";

) webserver.wait_for_open_port(80) webserver.succeed("curl http://localhost | grep hello") <ins> with subtest("explicit configFile"): webserver.succeed( "${explicitConfigFile}/bin/switch-to-configuration test >&2" ) webserver.wait_for_open_port(80) webserver.succeed("curl http://localhost | grep hello") </ins> ''; })