blob: 4e8f841305daadee11a651b0b7a58d663fe3c6c6 (
plain)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
{ config, lib, pkgs, ... }:
with lib; let
cfg = config.local.pki.ca;
in
{
options.local.pki.ca = mkOption {
readOnly = true;
type = with lib.types; attrsOf (submodule ({ config, name, ... }: {
options = {
cert = mkOption {
type = path;
readOnly = true;
};
crl = mkOption {
type = path;
readOnly = true;
};
fullchain = mkOption {
type = path;
readOnly = true;
};
issuer = mkOption {
type = nullOr str;
readOnly = true;
};
};
config.fullchain = pkgs.writeText "${name}-fullchain-crl.pem"
(concatStrings (map readFile
([ config.cert config.crl ] ++ optional (config.issuer != null) cfg.${config.issuer}.fullchain)));
}));
};
config.local.pki.ca = {
mail = {
crl = ./public/mail-crl.pem;
cert = ./public/mail-ca.pem;
issuer = "root";
};
root = {
crl = ./public/root-crl.pem;
cert = ./public/root-ca.pem;
issuer = null;
};
};
}
|