mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
caddy: withPlugins
better error messages for untagged plugins (#368657)
This commit is contained in:
commit
b821685bc8
4 changed files with 101 additions and 19 deletions
|
@ -289,14 +289,22 @@
|
|||
services.caddy = {
|
||||
enable = true;
|
||||
package = pkgs.caddy.withPlugins {
|
||||
plugins = [ "github.com/caddy-dns/powerdns@v1.0.1" ];
|
||||
hash = "sha256-F/jqR4iEsklJFycTjSaW8B/V3iTGqqGOzwYBUXxRKrc=";
|
||||
plugins = [
|
||||
# tagged upstream
|
||||
"github.com/caddy-dns/powerdns@v1.0.1"
|
||||
# pseudo-version number generated by Go
|
||||
"github.com/caddy-dns/cloudflare@v0.0.0-20240703190432-89f16b99c18e"
|
||||
"github.com/mholt/caddy-webdav@v0.0.0-20241008162340-42168ba04c9d"
|
||||
];
|
||||
hash = "sha256-wqXSd1Ep9TVpQi570TTb96LwzNYvWL5EBJXMJfYWCAk=";
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
To get the necessary hash of the vendored dependencies, omit `hash`. The build will fail and tell you the correct value.
|
||||
|
||||
Note that all provided plugins must have versions/tags (string after `@`), even if upstream repo does not tag each release. For untagged plugins, you can either create an empty Go project and run `go get <plugin>` and see changes in `go.mod` to get the pseudo-version number, or provide a commit hash in place of version/tag for the first run, and update the plugin string based on the error output.
|
||||
|
||||
- KDE Partition Manager `partitionmanager`'s support for ReiserFS is removed.
|
||||
ReiserFS has not been actively maintained for many years. It has been marked as obsolete since Linux 6.6, and
|
||||
[is removed](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c01f664e4ca210823b7594b50669bbd9b0a3c3b0)
|
||||
|
|
|
@ -3,12 +3,15 @@ import ./make-test-python.nix (
|
|||
{
|
||||
name = "caddy";
|
||||
meta = with pkgs.lib.maintainers; {
|
||||
maintainers = [ Br1ght0ne ];
|
||||
maintainers = [
|
||||
Br1ght0ne
|
||||
stepbrobd
|
||||
];
|
||||
};
|
||||
|
||||
nodes = {
|
||||
webserver =
|
||||
{ pkgs, lib, ... }:
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
services.caddy.enable = true;
|
||||
services.caddy.extraConfig = ''
|
||||
|
@ -63,6 +66,24 @@ import ./make-test-python.nix (
|
|||
respond "hello world"
|
||||
'';
|
||||
};
|
||||
specialisation.with-plugins.configuration = {
|
||||
services.caddy = {
|
||||
package = pkgs.caddy.withPlugins {
|
||||
plugins = [ "github.com/caddyserver/replace-response@v0.0.0-20241211194404-3865845790a7" ];
|
||||
hash = "sha256-zgMdtOJbmtRSfTlrrg8njr11in2C7OAXLB+34V23jek=";
|
||||
};
|
||||
configFile = pkgs.writeText "Caddyfile" ''
|
||||
{
|
||||
order replace after encode
|
||||
}
|
||||
|
||||
localhost:80 {
|
||||
respond "hello world"
|
||||
replace world caddy
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -73,6 +94,7 @@ import ./make-test-python.nix (
|
|||
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";
|
||||
withPluginsConfig = "${nodes.webserver.system.build.toplevel}/specialisation/with-plugins";
|
||||
in
|
||||
''
|
||||
url = "http://localhost/example.html"
|
||||
|
@ -108,6 +130,13 @@ import ./make-test-python.nix (
|
|||
)
|
||||
webserver.wait_for_open_port(80)
|
||||
webserver.succeed("curl http://localhost | grep hello")
|
||||
|
||||
with subtest("plugins are correctled installed and configurable"):
|
||||
webserver.succeed(
|
||||
"${withPluginsConfig}/bin/switch-to-configuration test >&2"
|
||||
)
|
||||
webserver.wait_for_open_port(80)
|
||||
webserver.succeed("curl http://localhost | grep caddy")
|
||||
'';
|
||||
}
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue