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