Unverified Commit 312aa96f authored by Fabián Heredia Montiel's avatar Fabián Heredia Montiel Committed by GitHub
Browse files

Merge pull request #256565 from bjornfor/nixos-wireguard-add-metric-option

nixos/wireguard: add metric option
parents 35d44e2b ed7c0c6e
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -164,6 +164,15 @@ let
          of the wireguard network has to be adjusted as well.
        '';
      };

      metric = mkOption {
        default = null;
        type = with types; nullOr int;
        example = 700;
        description = lib.mdDoc ''
          Set the metric of routes related to this Wireguard interface.
        '';
      };
    };

  };
@@ -395,7 +404,7 @@ let
            optionalString interfaceCfg.allowedIPsAsRoutes
              (concatMapStringsSep "\n"
                (allowedIP:
                  ''${ip} route replace "${allowedIP}" dev "${interfaceName}" table "${interfaceCfg.table}"''
                  ''${ip} route replace "${allowedIP}" dev "${interfaceName}" table "${interfaceCfg.table}" ${optionalString (interfaceCfg.metric != null) "metric ${toString interfaceCfg.metric}"}''
                ) peer.allowedIPs);
        in ''
          ${wg_setup}