refactor(nixosmodules): move boot config to module
This commit is contained in:
parent
2d29c8ffef
commit
5bef7c46a6
9 changed files with 61 additions and 57 deletions
|
@ -1,30 +0,0 @@
|
|||
{
|
||||
pkgs,
|
||||
modulesPath,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
boot = {
|
||||
loader = {
|
||||
timeout = 5;
|
||||
efi.canTouchEfiVariables = true;
|
||||
};
|
||||
kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
|
||||
initrd.availableKernelModules = [
|
||||
"ahci"
|
||||
"nvme"
|
||||
"sd_mod"
|
||||
"usb_storage"
|
||||
"usbhid"
|
||||
"xhci_pci"
|
||||
"rtsx_pci_sdmmc"
|
||||
];
|
||||
};
|
||||
services.dbus = {
|
||||
enable = true;
|
||||
};
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
boot.loader = {
|
||||
systemd-boot.enable = true;
|
||||
systemd-boot.configurationLimit = 5;
|
||||
};
|
||||
}
|
|
@ -1,11 +1,11 @@
|
|||
{ lib, config, ... }:
|
||||
{
|
||||
imports = [
|
||||
../configs/bootloaders/systemd-boot.nix
|
||||
../configs/filesystems/impermanence.nix
|
||||
../configs/services.nix
|
||||
];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
boot-config.bootloader = "systemd-boot";
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
imports =
|
||||
[
|
||||
../nixosModules
|
||||
../configs/boot.nix
|
||||
../configs/security.nix
|
||||
../configs/users.nix
|
||||
../configs/networking.nix
|
||||
|
@ -15,4 +14,5 @@
|
|||
];
|
||||
nixosModules.enable = true;
|
||||
nix-config.enable = true;
|
||||
boot-config.enable = true;
|
||||
}
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
{
|
||||
inputs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [
|
||||
../configs/bootloaders/systemd-boot.nix
|
||||
../configs/filesystems/impermanence.nix
|
||||
inputs.nixos-hardware.nixosModules.microsoft-surface-go
|
||||
];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
}
|
|
@ -6,7 +6,6 @@
|
|||
}:
|
||||
{
|
||||
imports = [
|
||||
../configs/bootloaders/systemd-boot.nix
|
||||
../configs/filesystems/hw-nemesis.nix
|
||||
../configs/hardware/nvidia.nix
|
||||
../configs/hardware/powermanagement.nix
|
||||
|
@ -15,4 +14,5 @@
|
|||
boot.kernelModules = [ "kvm-amd" ];
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
boot-config.bootloader = "systemd-boot";
|
||||
}
|
||||
|
|
51
nixosModules/boot.nix
Normal file
51
nixosModules/boot.nix
Normal file
|
@ -0,0 +1,51 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
modulesPath,
|
||||
...
|
||||
}:
|
||||
let
|
||||
moduleName = "boot-config";
|
||||
cfg = config."${moduleName}";
|
||||
in
|
||||
{
|
||||
options = {
|
||||
"${moduleName}" = {
|
||||
enable = lib.mkEnableOption "Enable ${moduleName}.";
|
||||
bootloader = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "";
|
||||
example = "systemd-boot";
|
||||
description = "What bootloader to use.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
boot = {
|
||||
loader =
|
||||
{
|
||||
timeout = 5;
|
||||
efi.canTouchEfiVariables = true;
|
||||
}
|
||||
// lib.mkIf (cfg.bootloader == "systemd-boot") {
|
||||
systemd-boot.enable = true;
|
||||
systemd-boot.configurationLimit = 5;
|
||||
};
|
||||
kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
|
||||
initrd.availableKernelModules = [
|
||||
"ahci"
|
||||
"nvme"
|
||||
"sd_mod"
|
||||
"usb_storage"
|
||||
"usbhid"
|
||||
"xhci_pci"
|
||||
"rtsx_pci_sdmmc"
|
||||
];
|
||||
};
|
||||
services.dbus = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -11,10 +11,13 @@ in
|
|||
{
|
||||
imports = [
|
||||
./nix-config.nix
|
||||
./boot.nix
|
||||
];
|
||||
|
||||
options = {
|
||||
"${moduleName}".enable = lib.mkEnableOption "Enable ${moduleName}.";
|
||||
"${moduleName}" = {
|
||||
enable = lib.mkEnableOption "Enable ${moduleName}.";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
|
|
@ -10,7 +10,9 @@ let
|
|||
in
|
||||
{
|
||||
options = {
|
||||
"${moduleName}".enable = lib.mkEnableOption "Enable ${moduleName}.";
|
||||
"${moduleName}" = {
|
||||
enable = lib.mkEnableOption "Enable ${moduleName}.";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue