git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/wireguard: Remove .path systemd unit for privkey. Fixes #123203

As per `man systemd.path`: > When a service unit triggered by a path unit terminates > (regardless whether it exited successfully or failed), > monitored paths are checked immediately again, > **and the service accordingly restarted instantly**. Thus the existence of the path unit made it impossible to stop the wireguard service using e.g. systemctl stop wireguard-wg0.service Systemd path units are not intended for program inputs such as private key files. This commit simply removes this usage; the private key is still generated by the `generateKeyServiceUnit`.

commitd344dccf3dc592242f11ef993acb9ecee8d84796 authorNiklas Hambüchen <mail@nh2.me> dateSun 16 May 2021, 17:47 (6 years ago) parentcb80b67
1 file changed−14
nixos/modules/services/networking/wireguard.nix−14
nixos/modules/services/networking/wireguard.nix−14
@@ -244,17 +244,6 @@ let
244244
245245 };
246246
247− generatePathUnit = name: values:
248− assert (values.privateKey == null);
249− assert (values.privateKeyFile != null);
250− nameValuePair "wireguard-${name}"
251− {
252− description = "WireGuard Tunnel - ${name} - Private Key";
253− requiredBy = [ "wireguard-${name}.service" ];
254− before = [ "wireguard-${name}.service" ];
255− pathConfig.PathExists = values.privateKeyFile;
256− };
257−
258247 generateKeyServiceUnit = name: values:
259248 assert values.generatePrivateKeyFile;
260249 nameValuePair "wireguard-${name}-key"
@@ -509,9 +498,6 @@ in
509498 // (mapAttrs' generateKeyServiceUnit
510499 (filterAttrs (name: value: value.generatePrivateKeyFile) cfg.interfaces));
511500
512− systemd.paths = mapAttrs' generatePathUnit
513− (filterAttrs (name: value: value.privateKeyFile != null) cfg.interfaces);
514−
515501 });
516502
517503}