mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-13 05:05:29 +03:00
azure-common: add accelerated networking configs
This commit is contained in:
parent
0799550a95
commit
f6fe3b3bff
1 changed files with 74 additions and 53 deletions
|
@ -1,14 +1,35 @@
|
|||
{ lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.virtualisation.azure;
|
||||
in
|
||||
{
|
||||
options.virtualisation.azure = {
|
||||
acceleratedNetworking = mkOption {
|
||||
default = false;
|
||||
description = "Whether the machine's network interface has enabled accelerated networking.";
|
||||
};
|
||||
};
|
||||
|
||||
imports = [ ../profiles/headless.nix ];
|
||||
|
||||
require = [ ./azure-agent.nix ];
|
||||
|
||||
config = let
|
||||
mlxDrivers = [ "mlx4_en" "mlx4_core" "mlx5_core" ];
|
||||
in
|
||||
{
|
||||
virtualisation.azure.agent.enable = true;
|
||||
|
||||
boot.kernelParams = [ "console=ttyS0" "earlyprintk=ttyS0" "rootdelay=300" "panic=1" "boot.panic_on_fail" ];
|
||||
boot.initrd.kernelModules = [ "hv_vmbus" "hv_netvsc" "hv_utils" "hv_storvsc" ];
|
||||
boot.initrd.kernelModules = [ "hv_vmbus" "hv_netvsc" "hv_utils" "hv_storvsc" ] ++ (lib.optionals cfg.acceleratedNetworking mlxDrivers);
|
||||
|
||||
# Accelerated networking
|
||||
systemd.network.networks."99-azure-unmanaged-devices.network" = lib.mkIf cfg.acceleratedNetworking {
|
||||
matchConfig.Driver = mlxDrivers;
|
||||
linkConfig.Unmanaged = "yes";
|
||||
};
|
||||
|
||||
# Generate a GRUB menu.
|
||||
boot.loader.grub.device = "/dev/sda";
|
||||
|
@ -63,5 +84,5 @@ with lib;
|
|||
ENV{DEVTYPE}=="disk", KERNEL!="sda" SUBSYSTEM=="block", SUBSYSTEMS=="scsi", KERNELS=="?:0:0:15", ATTR{removable}=="0", SYMLINK+="disk/by-lun/15"
|
||||
|
||||
'';
|
||||
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue