From f5908be619aac5febce2c2dbbf4da1b308e53828 Mon Sep 17 00:00:00 2001 From: codgician <15964984+codgician@users.noreply.github.com> Date: Sun, 29 Dec 2024 19:07:38 +0800 Subject: [PATCH] nixos/azure: improve code readability --- nixos/modules/virtualisation/azure-common.nix | 15 +++++---------- .../modules/virtualisation/azure-config-user.nix | 4 ++-- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/nixos/modules/virtualisation/azure-common.nix b/nixos/modules/virtualisation/azure-common.nix index 6d36838f9eaa80..654adb65ed2925 100644 --- a/nixos/modules/virtualisation/azure-common.nix +++ b/nixos/modules/virtualisation/azure-common.nix @@ -5,7 +5,6 @@ ... }: -with lib; let cfg = config.virtualisation.azure; mlxDrivers = [ @@ -16,7 +15,7 @@ let in { options.virtualisation.azure = { - acceleratedNetworking = mkOption { + acceleratedNetworking = lib.mkOption { default = false; description = "Whether the machine's network interface has enabled accelerated networking."; }; @@ -68,7 +67,7 @@ in services.openssh.settings.ClientAliveInterval = 180; # Force getting the hostname from Azure - networking.hostName = mkDefault ""; + networking.hostName = lib.mkDefault ""; # Always include cryptsetup so that NixOps can use it. # sg_scan is needed to finalize disk removal on older kernels @@ -79,12 +78,8 @@ in networking.usePredictableInterfaceNames = false; - services.udev.extraRules = - with builtins; - concatStringsSep "\n" ( - map (i: '' - ENV{DEVTYPE}=="disk", KERNEL!="sda" SUBSYSTEM=="block", SUBSYSTEMS=="scsi", KERNELS=="?:0:0:${toString i}", ATTR{removable}=="0", SYMLINK+="disk/by-lun/${toString i}" - '') (lib.range 1 15) - ); + services.udev.extraRules = lib.concatMapStrings (i: '' + ENV{DEVTYPE}=="disk", KERNEL!="sda" SUBSYSTEM=="block", SUBSYSTEMS=="scsi", KERNELS=="?:0:0:${toString i}", ATTR{removable}=="0", SYMLINK+="disk/by-lun/${toString i}" + '') (lib.range 1 15); }; } diff --git a/nixos/modules/virtualisation/azure-config-user.nix b/nixos/modules/virtualisation/azure-config-user.nix index aa00ac1f406133..75bbc716bf7f2a 100644 --- a/nixos/modules/virtualisation/azure-config-user.nix +++ b/nixos/modules/virtualisation/azure-config-user.nix @@ -13,6 +13,6 @@ "${modulesPath}/virtualisation/azure-image.nix" ]; - # Please update the VM Generation to the actual value - virtualisation.azureImage.vmGeneration = "v1"; + # Please set the VM Generation to the actual value + # virtualisation.azureImage.vmGeneration = "v1"; }