mirror of
				https://github.com/ItsDrike/nixdots
				synced 2025-11-04 08:16:36 +00:00 
			
		
		
		
	Don't represent vm status via cpu type
This commit is contained in:
		
							parent
							
								
									ae1def6432
								
							
						
					
					
						commit
						1c1e0abbd6
					
				
					 4 changed files with 13 additions and 5 deletions
				
			
		| 
						 | 
					@ -24,7 +24,8 @@
 | 
				
			||||||
      username = "itsdrike";
 | 
					      username = "itsdrike";
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
    device = {
 | 
					    device = {
 | 
				
			||||||
      cpu.type = "vm-amd";
 | 
					      virtual-machine = true;
 | 
				
			||||||
 | 
					      cpu.type = "amd";
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,14 +3,21 @@ in
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  options.myOptions.device = {
 | 
					  options.myOptions.device = {
 | 
				
			||||||
    cpu.type = mkOption {
 | 
					    cpu.type = mkOption {
 | 
				
			||||||
      type = with types; nullOr (enum [ "intel" "vm-intel" "amd" "vm-amd" ]);
 | 
					      type = with types; nullOr (enum [ "intel" "amd" ]);
 | 
				
			||||||
      default = null;
 | 
					      default = null;
 | 
				
			||||||
      description = ''
 | 
					      description = ''
 | 
				
			||||||
        The manifaturer/type of the primary system CPU.
 | 
					        The manifaturer/type of the primary system CPU.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Determines which ucode services will be enabled and provides additional kernel packages.
 | 
					        Determines which ucode services will be enabled and provides additional kernel packages.
 | 
				
			||||||
        If running in a virtual machine with forwarded/shared cores, use the `vm-` prefix.
 | 
					        If running in a virtual machine with forwarded/shared cores (CPU passthrough), use the
 | 
				
			||||||
 | 
					        cpu type of the host machine.
 | 
				
			||||||
      '';
 | 
					      '';
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    virtual-machine = mkOption {
 | 
				
			||||||
 | 
					      type = lib.types.bool;
 | 
				
			||||||
 | 
					      default = false;
 | 
				
			||||||
 | 
					      description = "Is this system a virtual machine?";
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,7 +3,7 @@ let
 | 
				
			||||||
  dev = config.myOptions.device;
 | 
					  dev = config.myOptions.device;
 | 
				
			||||||
in
 | 
					in
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  config = lib.mkIf (builtins.elem dev.cpu.type [ "amd" "vm-amd" ]) {
 | 
					  config = lib.mkIf (dev.cpu.type == "amd") {
 | 
				
			||||||
    hardware.cpu.amd.updateMicrocode = true;
 | 
					    hardware.cpu.amd.updateMicrocode = true;
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,7 +3,7 @@ let
 | 
				
			||||||
  dev = config.myOptions.device;
 | 
					  dev = config.myOptions.device;
 | 
				
			||||||
in
 | 
					in
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  config = lib.mkIf (builtins.elem dev.cpu.type [ "intel" "vm-intel" ]) {
 | 
					  config = lib.mkIf (dev.cpu.type == "intel") {
 | 
				
			||||||
    hardware.cpu.intel.updateMicrocode = true;
 | 
					    hardware.cpu.intel.updateMicrocode = true;
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue