diff --git a/nix/manifest.nix b/nix/manifest.nix index cd305e2..f87deed 100644 --- a/nix/manifest.nix +++ b/nix/manifest.nix @@ -6,7 +6,6 @@ let device = "/dev/sda1"; fsType = "ext4"; }; - nixpkgs.hostPlatform = "x86_64-linux"; boot.loader.systemd-boot.enable = true; networking = { inherit hostName; }; }; diff --git a/nix/modules/machine/platform.nix b/nix/modules/machine/platform.nix new file mode 100644 index 0000000..ae8ab61 --- /dev/null +++ b/nix/modules/machine/platform.nix @@ -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"; + }; +}