mirror of
https://github.com/Stunkymonkey/nixos.git
synced 2025-05-24 01:44:40 +02:00
service/acme: split from nginx
This commit is contained in:
parent
0314eeabd6
commit
bd2da85ef0
5 changed files with 45 additions and 25 deletions
|
@ -139,9 +139,6 @@ in
|
|||
# Webserver
|
||||
nginx = {
|
||||
enable = true;
|
||||
acme = {
|
||||
credentialsFile = secrets."acme/inwx".path;
|
||||
};
|
||||
sso = {
|
||||
authKeyFile = secrets."sso/auth-key".path;
|
||||
users = {
|
||||
|
@ -155,6 +152,10 @@ in
|
|||
};
|
||||
};
|
||||
};
|
||||
acme = {
|
||||
enable = true;
|
||||
credentialsFile = secrets."acme/inwx".path;
|
||||
};
|
||||
vpn = {
|
||||
enable = true;
|
||||
isMaster = true;
|
||||
|
|
|
@ -89,9 +89,6 @@ in
|
|||
# Webserver
|
||||
nginx = {
|
||||
enable = true;
|
||||
acme = {
|
||||
credentialsFile = secrets."acme/inwx".path;
|
||||
};
|
||||
sso = {
|
||||
authKeyFile = secrets."sso/auth-key".path;
|
||||
users = {
|
||||
|
@ -105,6 +102,10 @@ in
|
|||
};
|
||||
};
|
||||
};
|
||||
acme = {
|
||||
enable = true;
|
||||
credentialsFile = secrets."acme/inwx".path;
|
||||
};
|
||||
vpn.enable = true;
|
||||
};
|
||||
}
|
||||
|
|
36
modules/services/acme/default.nix
Normal file
36
modules/services/acme/default.nix
Normal file
|
@ -0,0 +1,36 @@
|
|||
# automatic certificates
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.my.services.acme;
|
||||
inherit (config.networking) domain;
|
||||
in
|
||||
{
|
||||
options.my.services.acme = with lib; {
|
||||
enable = mkEnableOption "ACME certificates";
|
||||
|
||||
credentialsFile = mkOption {
|
||||
type = types.str;
|
||||
example = "/var/lib/acme/creds.env";
|
||||
description = ''
|
||||
INWX API key file as an 'EnvironmentFile' (see `systemd.exec(5)`)
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
security.acme = {
|
||||
defaults.email = "server@buehler.rocks";
|
||||
# this is specially needed for inwx and does not work without it
|
||||
defaults.dnsResolver = "ns.inwx.de";
|
||||
acceptTerms = true;
|
||||
# Use DNS wildcard certificate
|
||||
certs = {
|
||||
"${config.networking.domain}" = {
|
||||
extraDomainNames = [ "*.${config.networking.domain}" ];
|
||||
dnsProvider = "inwx";
|
||||
inherit (cfg) credentialsFile;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
./acme
|
||||
./alertmanager
|
||||
./aria2
|
||||
./backup
|
||||
|
|
|
@ -448,24 +448,5 @@ in
|
|||
];
|
||||
# Nginx needs to be able to read the certificates
|
||||
users.users.nginx.extraGroups = [ "acme" ];
|
||||
security.acme = {
|
||||
defaults.email = "server@buehler.rocks";
|
||||
# this is specially needed for inwx and does not work without it
|
||||
defaults.dnsResolver = "ns.inwx.de";
|
||||
acceptTerms = true;
|
||||
# Use DNS wildcard certificate
|
||||
certs =
|
||||
let
|
||||
inherit (config.networking) domain;
|
||||
in
|
||||
with pkgs;
|
||||
{
|
||||
"${domain}" = {
|
||||
extraDomainNames = [ "*.${domain}" ];
|
||||
dnsProvider = "inwx";
|
||||
inherit (cfg.acme) credentialsFile;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue