Skip to content

Instantly share code, notes, and snippets.

@dasJ

dasJ/acme.nix Secret

Created February 19, 2019 22:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dasJ/e42471969f6e5c70188b470c5bc3c884 to your computer and use it in GitHub Desktop.
Save dasJ/e42471969f6e5c70188b470c5bc3c884 to your computer and use it in GitHub Desktop.
{
deployHook = ''
needsUpdate() {
[ -f "''${2}" ] || return 0
[ "$(sha512sum "''${2}")" = "$(sha512sum "/var/lib/acme/live/''${1}/fullchain.pem")" ] || return 0
return 1
}
${concatStringsSep "\n" (attrValues cfg.hooks)}
'';
# Use like this:
helsinki.acme.hooks.znc = ''
mkdir -p /var/lib/secrets/znc
if needsUpdate efcloud.co /var/lib/znc/znc.pem; then
cat /var/lib/acme/live/efcloud.co/{fullchain,privkey}.pem /var/lib/secrets/znc/dhparam.pem > /var/lib/znc/znc.pem
systemctl restart znc
fi
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment