1
1
Fork 1
mirror of https://github.com/oddlama/nix-config.git synced 2025-10-11 07:10:39 +02:00

feat: add customizable caddy package (with plugin support)

This commit is contained in:
oddlama 2023-06-05 01:14:46 +02:00
parent c5a863ce51
commit 6f84594c87
No known key found for this signature in database
GPG key ID: 14EFE510775FE39A
9 changed files with 90 additions and 26 deletions

21
hosts/sentinel/acme.nix Normal file
View file

@ -0,0 +1,21 @@
{config, ...}: let
inherit (config.repo.secrets.local) acme;
in {
rekey.secrets.acme-credentials = {
file = ./secrets/acme-credentials.age;
mode = "440";
group = "acme";
};
security.acme = {
acceptTerms = true;
defaults = {
inherit (acme) email;
credentialsFile = config.rekey.secrets.acme-credentials.path;
dnsProvider = "cloudflare";
dnsPropagationCheck = true;
reloadServices = ["nginx"];
};
};
extra.acme.wildcardDomains = acme.domains;
}

View file

@ -2,30 +2,12 @@
config,
lib,
nodes,
pkgs,
...
}: let
inherit (config.repo.secrets.local) acme personalDomain;
in {
networking.domain = personalDomain;
rekey.secrets.acme-credentials = {
file = ./secrets/acme-credentials.age;
mode = "440";
group = "acme";
};
security.acme = {
acceptTerms = true;
defaults = {
inherit (acme) email;
credentialsFile = config.rekey.secrets.acme-credentials.path;
dnsProvider = "cloudflare";
dnsPropagationCheck = true;
reloadServices = ["nginx"];
};
};
extra.acme.wildcardDomains = acme.domains;
users.groups.acme.members = ["nginx"];
users.groups.acme.members = ["caddy"];
rekey.secrets."dhparams.pem" = {
file = ./secrets/dhparams.pem.age;
@ -41,5 +23,15 @@ in {
lokiDomain = "loki.${personalDomain}";
lokiPort = toString nodes.ward-loki.config.services.loki.settings.server.http_port;
in {
enable = true;
package = pkgs.caddy.withPackages {
plugins = [
{
name = "github.com/greenpau/caddy-security";
version = "v1.1.18";
}
];
vendorHash = "sha256-RqSXQihtY5+ACaMo7bLdhu1A+qcraexb1W/Ia+aUF1k";
};
};
}

View file

@ -12,7 +12,8 @@
./fs.nix
./net.nix
#./nginx.nix
./acme.nix
./caddy.nix
#./nginx.nix
];
}

View file

@ -5,6 +5,7 @@
...
}: {
networking.hostId = config.repo.secrets.local.networking.hostId;
networking.domain = config.repo.secrets.local.personalDomain;
boot.initrd.systemd.network = {
enable = true;

View file

@ -6,8 +6,6 @@
}: let
inherit (config.repo.secrets.local) acme personalDomain;
in {
networking.domain = personalDomain;
rekey.secrets.acme-credentials = {
file = ./secrets/acme-credentials.age;
mode = "440";