refactor(modules/hardware): move hardware config to modules
This commit is contained in:
parent
cb01ba95b0
commit
067e0c9970
7 changed files with 40 additions and 10 deletions
9
modules/nixos/hardware/audio.nix
Normal file
9
modules/nixos/hardware/audio.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{ config, lib, ... }:
|
||||
{
|
||||
config = {
|
||||
services.pipewire = {
|
||||
enable = true;
|
||||
pulse.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -5,6 +5,7 @@ in
|
|||
{
|
||||
config = lib.mkIf (cfg.enable) (lib.mkMerge [
|
||||
{
|
||||
boot.initrd.kernelModules = [ "dm-snapshot" ];
|
||||
disko.devices.disk.main = {
|
||||
device = cfg.drive;
|
||||
type = "disk";
|
||||
|
|
9
modules/nixos/hardware/cpu.nix
Normal file
9
modules/nixos/hardware/cpu.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{ config, lib, ... }:
|
||||
{
|
||||
config = lib.mkMerge [
|
||||
(lib.mkIf (config.hardware.platform == "amd"){
|
||||
hardware.cpu.amd.updateMicrocode = true;
|
||||
boot.kernelModules = [ "kvm-amd" ];
|
||||
})
|
||||
];
|
||||
}
|
|
@ -3,6 +3,8 @@
|
|||
imports = [
|
||||
./btrfs.nix
|
||||
./nvidia.nix
|
||||
./audio.nix
|
||||
./cpu.nix
|
||||
];
|
||||
|
||||
options.hardware = {
|
||||
|
@ -12,5 +14,6 @@
|
|||
ephemeralRoot = lib.mkEnableOption "";
|
||||
};
|
||||
gpu = lib.pantheon.mkStrOption;
|
||||
platform = lib.pantheon.mkStrOption;
|
||||
};
|
||||
}
|
||||
|
|
12
modules/nixos/system/boot.nix
Normal file
12
modules/nixos/system/boot.nix
Normal file
|
@ -0,0 +1,12 @@
|
|||
{ config, lib, ... }:
|
||||
{
|
||||
config = lib.mkMerge [
|
||||
{
|
||||
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
}
|
||||
(lib.mkIf (config.system.bootloader == "systemd-boot"){
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
})
|
||||
];
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
{ config, lib, ...}:
|
||||
{
|
||||
imports = [
|
||||
./boot.nix
|
||||
./users.nix
|
||||
./localisation.nix
|
||||
./nix-config.nix
|
||||
|
@ -8,6 +9,7 @@
|
|||
|
||||
options.system = {
|
||||
mainUser = lib.pantheon.mkStrOption;
|
||||
bootloader = lib.pantheon.mkStrOption;
|
||||
};
|
||||
|
||||
config = {
|
||||
|
|
|
@ -1,30 +1,24 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
system.mainUser = "rafiq";
|
||||
system.bootloader = "systemd-boot";
|
||||
hardware.drives.btrfs = {
|
||||
enable = true;
|
||||
drive = "/dev/disk/by-id/nvme-CT2000P3SSD8_2325E6E77434";
|
||||
ephemeralRoot = true;
|
||||
};
|
||||
hardware.platform = "amd";
|
||||
hardware.gpu = "nvidia";
|
||||
|
||||
|
||||
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
|
||||
boot.initrd.kernelModules = [ "dm-snapshot" ];
|
||||
boot.kernelModules = [ "kvm-amd" ];
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
|
||||
|
||||
networking.useDHCP = lib.mkDefault true;
|
||||
networking.hostName = "nemesis"; # Define your hostname.
|
||||
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
|
||||
|
||||
services.pipewire = {
|
||||
enable = true;
|
||||
pulse.enable = true;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue