Switchable Hardware Configuration

- Move generated hardware-configuration.nix files to hardware folder
- Add flake.nix option to select which hardware configuration to use
This commit is contained in:
Sravan Balaji
2024-03-24 21:02:39 -04:00
parent 4a157b888b
commit 43fcffba37
4 changed files with 26 additions and 1 deletions

View File

@ -26,6 +26,7 @@
locale = "en_US.UTF-8"; # Locale
diskoConfig = "luks-btrfs-subvolumes"; # Select the disko config that was used to partition drive
desktopEnvironment = "gnome"; # Window Manager / Desktop Environment to use
hardwareConfiguration = "qemu-vm"; # Select the hardware config from hardware directory
};
# --- USER SETTINGS --- #

24
hardware/qemu-vm.nix Normal file
View File

@ -0,0 +1,24 @@
# Do not modify this file! It was generated by 'nixos-generate-config'
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with 'networking.interfaces.<interface>.useDHCP'.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp1s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}

View File

@ -6,7 +6,7 @@
{
imports = [
../../system/hardware-configuration.nix
(./. + "../../hardware" + ("/" + systemSettings.hardwareConfiguration) + ".nix")
../../system/hardware/kernel.nix
../../system/hardware/bluetooth.nix
../../system/hardware/opengl.nix