feat(nixos): add platform module for different architectures
This commit is contained in:
parent
27161d6b13
commit
0b2f2100cc
2 changed files with 14 additions and 1 deletions
|
@ -6,7 +6,6 @@ let
|
|||
device = "/dev/sda1";
|
||||
fsType = "ext4";
|
||||
};
|
||||
nixpkgs.hostPlatform = "x86_64-linux";
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
networking = { inherit hostName; };
|
||||
};
|
||||
|
|
14
nix/modules/machine/platform.nix
Normal file
14
nix/modules/machine/platform.nix
Normal 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";
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue