ctucx.git: dns.nix

fork of https://github.com/kirelagin/dns.nix

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 
#
# SPDX-FileCopyrightText: 2019 Kirill Elagin <https://kir.elagin.me/>
#
# SPDX-License-Identifier: MPL-2.0 or MIT
#

# RFC 8659

{ lib }:

let
  inherit (lib) mkOption types;

in

{
  rtype = "CAA";
  options = {
    issuerCritical = mkOption {
      type = types.bool;
      example = true;
      description = "If set to '1', indicates that the corresponding property tag MUST be understood if the semantics of the CAA record are to be correctly interpreted by an issuer";
    };
    tag = mkOption {
      type = types.enum ["issue" "issuewild" "iodef"];
      example = "issue";
      description = "One of the defined property tags";
    };
    value = mkOption {
      type = types.str;  # section 4.1.1: not limited in length
      example = "ca.example.net";
      description = "Value of the property";
    };
  };
  dataToString = {issuerCritical, tag, value, ...}:
    ''${if issuerCritical then "1" else "0"} ${tag} "${value}"'';
}