about summary refs log tree commit diff
path: root/modules/acme.nix
blob: 9a2f3f1fa177a2c0405b60c7ec4c687c2252160d (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
31
32
33
34
35
36
37
38
39
{ config, lib, ... }:
with lib;
let
  cfg = config.nixfiles.modules.acme;
in
{
  imports = [
    (mkAliasOptionModule
      [ "certs" ]
      [
        "security"
        "acme"
        "certs"
      ]
    )
  ];

  options.nixfiles.modules.acme = {
    enable = mkEnableOption "ACME";

    email = mkOption {
      description = "Email for notifications.";
      type = with types; str;
      default = "admin+acme@${my.domain.shire}";
    };
  };

  config = mkIf cfg.enable {
    ark.directories = [ "/var/lib/acme" ];

    security.acme = {
      acceptTerms = true;
      defaults = {
        inherit (cfg) email;
        validMinDays = 60;
      };
    };
  };
}

Consider giving Nix/NixOS a try! <3