nixpkgs/nixos/modules/services/networking/rxe.nix
pennae ef176dcf7e nixos/*: automatically convert option descriptions
conversions were done using https://github.com/pennae/nix-doc-munge
using (probably) rev f34e145 running

    nix-doc-munge nixos/**/*.nix
    nix-doc-munge --import nixos/**/*.nix

the tool ensures that only changes that could affect the generated
manual *but don't* are committed, other changes require manual review
and are discarded.
2022-08-31 16:32:53 +02:00

53 lines
1.2 KiB
Nix

{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.networking.rxe;
in {
###### interface
options = {
networking.rxe = {
enable = mkEnableOption (lib.mdDoc "RDMA over converged ethernet");
interfaces = mkOption {
type = types.listOf types.str;
default = [ ];
example = [ "eth0" ];
description = lib.mdDoc ''
Enable RDMA on the listed interfaces. The corresponding virtual
RDMA interfaces will be named rxe_\<interface\>.
UDP port 4791 must be open on the respective ethernet interfaces.
'';
};
};
};
###### implementation
config = mkIf cfg.enable {
systemd.services.rxe = {
description = "RoCE interfaces";
wantedBy = [ "multi-user.target" ];
after = [ "systemd-modules-load.service" "network-online.target" ];
wants = [ "network-pre.target" ];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
ExecStart = map ( x:
"${pkgs.iproute2}/bin/rdma link add rxe_${x} type rxe netdev ${x}"
) cfg.interfaces;
ExecStop = map ( x:
"${pkgs.iproute2}/bin/rdma link delete rxe_${x}"
) cfg.interfaces;
};
};
};
}