feat(nixos): add platform module for different architectures

This commit is contained in:
Mohammad Rafiq 2025-07-07 10:38:17 +08:00
parent 27161d6b13
commit 0b2f2100cc
No known key found for this signature in database
2 changed files with 14 additions and 1 deletions

View file

@ -6,7 +6,6 @@ let
device = "/dev/sda1"; device = "/dev/sda1";
fsType = "ext4"; fsType = "ext4";
}; };
nixpkgs.hostPlatform = "x86_64-linux";
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
networking = { inherit hostName; }; networking = { inherit hostName; };
}; };

View file

@ -0,0 +1,14 @@
{ config, ... }:
{
flake.modules.nixos.default =
{ hostName, ... }:
let
inherit (config.flake.manifest.hosts.nixos.${hostName}.machine) platform;
arch = if platform == "amd" || platform == "intel" then "x86_64" else "aarch64";
in
{
hardware.cpu.${platform}.updateMicrocode = true;
boot.kernelModules = [ "kvm-${platform}" ];
nixpkgs.hostPlatform = "${arch}-linux";
};
}