lnd: make ExecStartPost extensible

By wrapping the value in a list, users can add other `ExecStartPost` scripts.
The previous scalar value could only be replaced, but not merged with
other definitions.
This commit is contained in:
Erik Arvstedt 2024-11-06 16:48:30 +01:00
parent 951c61b8ec
commit ca96e1959e
No known key found for this signature in database
GPG key ID: 33312B944DD97846

View file

@ -262,9 +262,8 @@ in {
ExecStartPost = let
curl = "${pkgs.curl}/bin/curl -fsS --cacert ${cfg.certPath}";
restUrl = "https://${nbLib.addressWithPort cfg.restAddress cfg.restPort}/v1";
in
# Setting macaroon permissions for other users needs root permissions
nbLib.rootScript "lnd-create-macaroons" ''
script = nbLib.rootScript "lnd-create-macaroons" ''
umask ug=r,o=
${lib.concatMapStrings (macaroon: ''
echo "Create custom macaroon ${macaroon}"
@ -278,6 +277,9 @@ in {
chown ${cfg.macaroons.${macaroon}.user}: "$macaroonPath"
'') (attrNames cfg.macaroons)}
'';
in [
script
];
} // nbLib.allowedIPAddresses cfg.tor.enforce;
};