summaryrefslogtreecommitdiff
path: root/custom/simp_le.nix
blob: a71966188602a98a0fc5cb7718d3d8fb202c1668 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{ domains ? []
, simp_le
, lib
, writeText
}:

let
  getcert = domain: ''
    date=$(date -u +'%Y-%m-%d')
    mkdir -p /etc/ssl/${domain}/$date /srv/www/acme/${domain} || exit 1
    cd /etc/ssl/${domain}/$date || exit 1
    simp_le \
      -f cert.pem -f key.pem -f fullchain.pem -f account_key.json \
      --email phikeebaogobaegh@141.li \
      -d ${domain}:/srv/www/acme/${domain} \
      && ln -fs /etc/ssl/${domain}/$date /etc/ssl/current
  '';
in writeText "certs.sh" (lib.concatMapStringsSep "\n" getcert domains)