1 { config, lib, pkgs, ... }:
4 cfg = config.hardware.infiniband;
8 description = "Starts OpenSM Infiniband fabric Subnet Managers";
9 before = [ "network.target"];
11 ConditionPathExists = "/sys/class/infiniband_mad/abi_version";
15 ExecStart = "${pkgs.opensm}/bin/opensm --guid %I --log_file /var/log/opensm.%I.log";
18 } // (builtins.listToAttrs (map (guid: {
19 name = "opensm@${guid}";
22 wantedBy = [ "machines.target" ];
23 overrideStrategy = "asDropin";
30 options.hardware.infiniband = {
31 enable = lib.mkEnableOption "Infiniband support";
32 guids = lib.mkOption {
33 type = with lib.types; listOf str;
35 example = [ "0xe8ebd30000eee2e1" ];
37 A list of infiniband port guids on the system. This is discoverable using `ibstat -p`
42 config = lib.mkIf cfg.enable {
43 boot.initrd.kernelModules = [
44 "mlx5_core" "mlx5_ib" "ib_cm"
45 "rdma_cm" "rdma_ucm" "rpcrdma"
46 "ib_ipoib" "ib_isert" "ib_umad" "ib_uverbs"
48 # rdma-core exposes ibstat, mstflint exposes mstconfig (which can be needed for
49 # setting link configurations), qperf needed to affirm link speeds
50 environment.systemPackages = with pkgs; [
51 rdma-core mstflint qperf
53 systemd.services = opensm-services;