about summary refs log tree commit diff
path: root/modules/nixos/acme.nix
blob: d3ad6619c263a823f75e049459df05804444f6f1 (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
{
  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 {
    security.acme = {
      acceptTerms = true;
      defaults = {
        inherit (cfg) email;
        validMinDays = 60;
      };
    };
  };
}

Consider giving Nix/NixOS a try! <3