commit
26108ada86
@ -6,8 +6,6 @@ let
|
||||
cfg = config.services.caddy;
|
||||
configFile = pkgs.writeText "Caddyfile" cfg.config;
|
||||
|
||||
# v2-specific options
|
||||
isCaddy2 = versionAtLeast cfg.package.version "2.0";
|
||||
tlsConfig = {
|
||||
apps.tls.automation.policies = [{
|
||||
issuer = {
|
||||
@ -50,7 +48,7 @@ in {
|
||||
example = "nginx";
|
||||
type = types.str;
|
||||
description = ''
|
||||
Name of the config adapter to use. Not applicable to Caddy v1.
|
||||
Name of the config adapter to use.
|
||||
See https://caddyserver.com/docs/config-adapters for the full list.
|
||||
'';
|
||||
};
|
||||
@ -90,11 +88,10 @@ in {
|
||||
package = mkOption {
|
||||
default = pkgs.caddy;
|
||||
defaultText = "pkgs.caddy";
|
||||
example = "pkgs.caddy1";
|
||||
example = "pkgs.caddy";
|
||||
type = types.package;
|
||||
description = ''
|
||||
Caddy package to use.
|
||||
To use Caddy v1 (obsolete), set this to <literal>pkgs.caddy1</literal>.
|
||||
'';
|
||||
};
|
||||
};
|
||||
@ -106,21 +103,9 @@ in {
|
||||
after = [ "network-online.target" ];
|
||||
wants = [ "network-online.target" ]; # systemd-networkd-wait-online.service
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
environment = mkIf (versionAtLeast config.system.stateVersion "17.09" && !isCaddy2)
|
||||
{ CADDYPATH = cfg.dataDir; };
|
||||
serviceConfig = {
|
||||
ExecStart = if isCaddy2 then ''
|
||||
${cfg.package}/bin/caddy run --config ${configJSON}
|
||||
'' else ''
|
||||
${cfg.package}/bin/caddy -log stdout -log-timestamps=false \
|
||||
-root=/var/tmp -conf=${configFile} \
|
||||
-ca=${cfg.ca} -email=${cfg.email} ${optionalString cfg.agree "-agree"}
|
||||
'';
|
||||
ExecReload =
|
||||
if isCaddy2 then
|
||||
"${cfg.package}/bin/caddy reload --config ${configJSON}"
|
||||
else
|
||||
"${pkgs.coreutils}/bin/kill -USR1 $MAINPID";
|
||||
ExecStart = "${cfg.package}/bin/caddy run --config ${configJSON}";
|
||||
ExecReload = "${cfg.package}/bin/caddy reload --config ${configJSON}";
|
||||
Type = "simple";
|
||||
User = "caddy";
|
||||
Group = "caddy";
|
||||
|
@ -1,38 +0,0 @@
|
||||
{ stdenv, buildGoModule, fetchFromGitHub }:
|
||||
|
||||
buildGoModule rec {
|
||||
pname = "caddy";
|
||||
version = "1.0.5";
|
||||
|
||||
goPackagePath = "github.com/caddyserver/caddy";
|
||||
|
||||
subPackages = [ "caddy" ];
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "caddyserver";
|
||||
repo = pname;
|
||||
rev = "v${version}";
|
||||
sha256 = "0jrhwmr6gggppskg5h450wybzkv17iq69dgw36hd1dp56q002i7g";
|
||||
};
|
||||
|
||||
vendorSha256 = "09vnci9pp8zp7bvn8zj68wslz2nc54nhcd0ll31sqfjbp00215mj";
|
||||
|
||||
preBuild = ''
|
||||
cat << EOF > caddy/main.go
|
||||
package main
|
||||
import "github.com/caddyserver/caddy/caddy/caddymain"
|
||||
var run = caddymain.Run // replaced for tests
|
||||
func main() {
|
||||
caddymain.EnableTelemetry = false
|
||||
run()
|
||||
}
|
||||
EOF
|
||||
'';
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
homepage = "https://caddyserver.com";
|
||||
description = "Fast, cross-platform HTTP/2 web server with automatic HTTPS";
|
||||
license = licenses.asl20;
|
||||
maintainers = with maintainers; [ rushmorem fpletz zimbatm filalex77 ];
|
||||
};
|
||||
}
|
@ -67,6 +67,7 @@ mapAliases ({
|
||||
buildGo112Package = throw "buildGo112Package has been removed"; # added 2020-04-26
|
||||
buildGo112Module = throw "buildGo112Module has been removed"; # added 2020-04-26
|
||||
bundler_HEAD = bundler; # added 2015-11-15
|
||||
caddy1 = throw "caddy 1.x has been removed from nixpkgs, as it's unmaintained: https://github.com/caddyserver/caddy/blob/master/.github/SECURITY.md#supported-versions"; # added 2020-10-02
|
||||
cantarell_fonts = cantarell-fonts; # added 2018-03-03
|
||||
cargo-tree = throw "cargo-tree has been removed, use the builtin `cargo tree` command instead."; # added 2020-08-20
|
||||
casperjs = throw "casperjs has been removed, it was abandoned by upstream and broken.";
|
||||
|
@ -1531,10 +1531,6 @@ in
|
||||
});
|
||||
|
||||
caddy = callPackage ../servers/caddy { };
|
||||
caddy1 = callPackage ../servers/caddy/v1.nix {
|
||||
# https://github.com/lucas-clemente/quic-go/issues/2614
|
||||
buildGoModule = buildGo114Module;
|
||||
};
|
||||
|
||||
traefik = callPackage ../servers/traefik { };
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user