netns-isolation: avoid creating service files for disabled services

Only set the `serviceConfig` option when the service is enabled.
Otherwise a service file is created.
This commit is contained in:
Erik Arvstedt 2021-11-26 15:13:33 +01:00
parent 017e08ca10
commit c6fe017aeb
No known key found for this signature in database
GPG Key ID: 33312B944DD97846

View File

@ -332,14 +332,16 @@ in {
payjoinAddress = netns.joinmarket.address; payjoinAddress = netns.joinmarket.address;
cliExec = mkCliExec "joinmarket"; cliExec = mkCliExec "joinmarket";
}; };
systemd.services.joinmarket-yieldgenerator.serviceConfig.NetworkNamespacePath = "/var/run/netns/nb-joinmarket"; systemd.services.joinmarket-yieldgenerator = mkIf config.services.joinmarket.yieldgenerator.enable {
serviceConfig.NetworkNamespacePath = "/var/run/netns/nb-joinmarket";
};
services.joinmarket-ob-watcher.address = netns.joinmarket-ob-watcher.address; services.joinmarket-ob-watcher.address = netns.joinmarket-ob-watcher.address;
services.lightning-pool.rpcAddress = netns.lightning-pool.address; services.lightning-pool.rpcAddress = netns.lightning-pool.address;
services.rtl.address = netns.rtl.address; services.rtl.address = netns.rtl.address;
systemd.services.cl-rest = { systemd.services.cl-rest = mkIf config.services.rtl.cl-rest.enable {
serviceConfig.NetworkNamespacePath = "/var/run/netns/nb-rtl"; serviceConfig.NetworkNamespacePath = "/var/run/netns/nb-rtl";
requires = [ "netns-rtl.service" ] ; requires = [ "netns-rtl.service" ] ;
after = [ "netns-rtl.service" ]; after = [ "netns-rtl.service" ];