Unverified Commit 56141e22 authored by Isabelle's avatar Isabelle Committed by GitHub
Browse files

nixos/wireguard: add option preShutdown for commands called before interface deletion (#310345)

parent dc2ac5f4
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -80,6 +80,15 @@ let
        description = "Commands called at the end of the interface setup.";
      };

      preShutdown = mkOption {
        example = literalExpression ''"''${pkgs.iproute2}/bin/ip netns del foo"'';
        default = "";
        type = with types; coercedTo (listOf str) (concatStringsSep "\n") lines;
        description = ''
          Commands called before shutting down the interface.
        '';
      };

      postShutdown = mkOption {
        example = literalExpression ''"''${pkgs.openresolv}/bin/resolvconf -d wg0"'';
        default = "";
@@ -497,6 +506,7 @@ let
        '';

        postStop = ''
          ${values.preShutdown}
          ${ipPostMove} link del dev "${name}"
          ${values.postShutdown}
        '';