about summary refs log tree commit diff
path: root/modules/nixos/acme.nix
blob: 49be6842c2f24ed24f15738d9d5f435ddca99673 (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
{
  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