aboutsummaryrefslogtreecommitdiff
path: root/virtual/modules/certificates.nix
blob: 09484e6ae7893798195140edf6b713a55872433a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
{ lib, pkgs, config, mylibs, ... }:
{
  options.services.myCertificates = {
    certConfig = lib.mkOption {
      default = {
        webroot = "/var/lib/acme/acme-challenge";
        email = "ismael@bouya.org";
        postRun = ''
          systemctl reload httpdTools.service httpdInte.service httpdProd.service
        '';
        plugins = [ "cert.pem" "chain.pem" "fullchain.pem" "full.pem" "key.pem" "account_key.json" ];
      };
      description = "Default configuration for certificates";
    };
  };

  config = {
    # FIXME: doesn't work with httpd?
    security.acme.preliminarySelfsigned = true;

    security.acme.certs = {
      # FIXME: /!\ To create a new certificate, create it before using
      # it in httpd
      "eldiron" = config.services.myCertificates.certConfig // {
        domain = "eldiron.immae.eu";
      };
    };
  };
}