mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-25 10:36:36 +03:00

Format all Nix files using the officially approved formatter, making the CI check introduced in the previous commit succeed: nix-build ci -A fmt.check This is the next step of the of the [implementation](https://github.com/NixOS/nixfmt/issues/153) of the accepted [RFC 166](https://github.com/NixOS/rfcs/pull/166). This commit will lead to merge conflicts for a number of PRs, up to an estimated ~1100 (~33%) among the PRs with activity in the past 2 months, but that should be lower than what it would be without the previous [partial treewide format](https://github.com/NixOS/nixpkgs/pull/322537). Merge conflicts caused by this commit can now automatically be resolved while rebasing using the [auto-rebase script](8616af08d9/maintainers/scripts/auto-rebase
). If you run into any problems regarding any of this, please reach out to the [formatting team](https://nixos.org/community/teams/formatting/) by pinging @NixOS/nix-formatting. (branch-equivalent to commit374e6bcc40
)
109 lines
4.4 KiB
Nix
109 lines
4.4 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
|
|
with lib;
|
|
let
|
|
cfg = config.virtualisation.azure;
|
|
mlxDrivers = [
|
|
"mlx4_en"
|
|
"mlx4_core"
|
|
"mlx5_core"
|
|
];
|
|
in
|
|
{
|
|
options.virtualisation.azure = {
|
|
acceleratedNetworking = mkOption {
|
|
default = false;
|
|
description = "Whether the machine's network interface has enabled accelerated networking.";
|
|
};
|
|
};
|
|
|
|
imports = [
|
|
../profiles/headless.nix
|
|
./azure-agent.nix
|
|
];
|
|
|
|
config = {
|
|
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.availableKernelModules = 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";
|
|
};
|
|
networking.networkmanager.unmanaged = lib.mkIf cfg.acceleratedNetworking (
|
|
builtins.map (drv: "driver:${drv}") mlxDrivers
|
|
);
|
|
|
|
# Generate a GRUB menu.
|
|
boot.loader.grub.device = "/dev/sda";
|
|
|
|
boot.growPartition = true;
|
|
|
|
fileSystems."/" = {
|
|
device = "/dev/disk/by-label/nixos";
|
|
fsType = "ext4";
|
|
autoResize = true;
|
|
};
|
|
|
|
# Allow root logins only using the SSH key that the user specified
|
|
# at instance creation time, ping client connections to avoid timeouts
|
|
services.openssh.enable = true;
|
|
services.openssh.settings.PermitRootLogin = "prohibit-password";
|
|
services.openssh.settings.ClientAliveInterval = 180;
|
|
|
|
# Force getting the hostname from Azure
|
|
networking.hostName = mkDefault "";
|
|
|
|
# Always include cryptsetup so that NixOps can use it.
|
|
# sg_scan is needed to finalize disk removal on older kernels
|
|
environment.systemPackages = [
|
|
pkgs.cryptsetup
|
|
pkgs.sg3_utils
|
|
];
|
|
|
|
networking.usePredictableInterfaceNames = false;
|
|
|
|
services.udev.extraRules = ''
|
|
ENV{DEVTYPE}=="disk", KERNEL!="sda" SUBSYSTEM=="block", SUBSYSTEMS=="scsi", KERNELS=="?:0:0:0", ATTR{removable}=="0", SYMLINK+="disk/by-lun/0",
|
|
ENV{DEVTYPE}=="disk", KERNEL!="sda" SUBSYSTEM=="block", SUBSYSTEMS=="scsi", KERNELS=="?:0:0:1", ATTR{removable}=="0", SYMLINK+="disk/by-lun/1",
|
|
ENV{DEVTYPE}=="disk", KERNEL!="sda" SUBSYSTEM=="block", SUBSYSTEMS=="scsi", KERNELS=="?:0:0:2", ATTR{removable}=="0", SYMLINK+="disk/by-lun/2"
|
|
ENV{DEVTYPE}=="disk", KERNEL!="sda" SUBSYSTEM=="block", SUBSYSTEMS=="scsi", KERNELS=="?:0:0:3", ATTR{removable}=="0", SYMLINK+="disk/by-lun/3"
|
|
|
|
ENV{DEVTYPE}=="disk", KERNEL!="sda" SUBSYSTEM=="block", SUBSYSTEMS=="scsi", KERNELS=="?:0:0:4", ATTR{removable}=="0", SYMLINK+="disk/by-lun/4"
|
|
ENV{DEVTYPE}=="disk", KERNEL!="sda" SUBSYSTEM=="block", SUBSYSTEMS=="scsi", KERNELS=="?:0:0:5", ATTR{removable}=="0", SYMLINK+="disk/by-lun/5"
|
|
ENV{DEVTYPE}=="disk", KERNEL!="sda" SUBSYSTEM=="block", SUBSYSTEMS=="scsi", KERNELS=="?:0:0:6", ATTR{removable}=="0", SYMLINK+="disk/by-lun/6"
|
|
ENV{DEVTYPE}=="disk", KERNEL!="sda" SUBSYSTEM=="block", SUBSYSTEMS=="scsi", KERNELS=="?:0:0:7", ATTR{removable}=="0", SYMLINK+="disk/by-lun/7"
|
|
|
|
ENV{DEVTYPE}=="disk", KERNEL!="sda" SUBSYSTEM=="block", SUBSYSTEMS=="scsi", KERNELS=="?:0:0:8", ATTR{removable}=="0", SYMLINK+="disk/by-lun/8"
|
|
ENV{DEVTYPE}=="disk", KERNEL!="sda" SUBSYSTEM=="block", SUBSYSTEMS=="scsi", KERNELS=="?:0:0:9", ATTR{removable}=="0", SYMLINK+="disk/by-lun/9"
|
|
ENV{DEVTYPE}=="disk", KERNEL!="sda" SUBSYSTEM=="block", SUBSYSTEMS=="scsi", KERNELS=="?:0:0:10", ATTR{removable}=="0", SYMLINK+="disk/by-lun/10"
|
|
ENV{DEVTYPE}=="disk", KERNEL!="sda" SUBSYSTEM=="block", SUBSYSTEMS=="scsi", KERNELS=="?:0:0:11", ATTR{removable}=="0", SYMLINK+="disk/by-lun/11"
|
|
|
|
ENV{DEVTYPE}=="disk", KERNEL!="sda" SUBSYSTEM=="block", SUBSYSTEMS=="scsi", KERNELS=="?:0:0:12", ATTR{removable}=="0", SYMLINK+="disk/by-lun/12"
|
|
ENV{DEVTYPE}=="disk", KERNEL!="sda" SUBSYSTEM=="block", SUBSYSTEMS=="scsi", KERNELS=="?:0:0:13", ATTR{removable}=="0", SYMLINK+="disk/by-lun/13"
|
|
ENV{DEVTYPE}=="disk", KERNEL!="sda" SUBSYSTEM=="block", SUBSYSTEMS=="scsi", KERNELS=="?:0:0:14", ATTR{removable}=="0", SYMLINK+="disk/by-lun/14"
|
|
ENV{DEVTYPE}=="disk", KERNEL!="sda" SUBSYSTEM=="block", SUBSYSTEMS=="scsi", KERNELS=="?:0:0:15", ATTR{removable}=="0", SYMLINK+="disk/by-lun/15"
|
|
|
|
'';
|
|
};
|
|
}
|