Skip to content

Commit

Permalink
nixos/acme: Fix postRun in acme certificate being ran at every run
Browse files Browse the repository at this point in the history
  • Loading branch information
immae committed Apr 17, 2020
1 parent bcfca55 commit 8e88b8d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion nixos/modules/security/acme.nix
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,9 @@ in
# Test that existing cert is older than new cert
KEY=${spath}/certificates/${keyName}.key
KEY_CHANGED=no
if [ -e $KEY -a $KEY -nt key.pem ]; then
KEY_CHANGED=yes
cp -p ${spath}/certificates/${keyName}.key key.pem
cp -p ${spath}/certificates/${keyName}.crt fullchain.pem
cp -p ${spath}/certificates/${keyName}.issuer.crt chain.pem
Expand All @@ -360,7 +362,10 @@ in
chmod ${fileMode} *.pem
chown '${data.user}:${data.group}' *.pem
${data.postRun}
if [ "$KEY_CHANGED" = "yes" ]; then
: # noop in case postRun is empty
${data.postRun}
fi
'';
in
"+${script}";
Expand Down

0 comments on commit 8e88b8d

Please sign in to comment.