aboutsummaryrefslogtreecommitdiff
path: root/virtual/modules/certificates.nix
blob: a9d6d99e93ccf36d3696d57e0ad8b8dd37ed1632 (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
30
{ lib, pkgs, config, mylibs, ... }:
{
  options.services.myCertificates = {
    certConfig = lib.mkOption {
      default = {
        webroot = "/var/lib/acme/acme-challenge";
        email = "ismael@bouya.org";
        postRun = ''
          systemctl reload httpd.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";
        allowKeysForGroup = true;
      };
    };
  };
}