about summary refs log tree commit diff
path: root/modules/acme.nix
blob: bbaf434683c7bb30e8a96719aa0ad4f7c14ea73d (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 = "hostmaster@${my.domain.shire}";
    };
  };

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

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

Consider giving Nix/NixOS a try! <3