整理微码设置

This commit is contained in:
2023-07-14 17:10:53 +08:00
parent a36922f81d
commit 3141be3fc1
3 changed files with 19 additions and 15 deletions

View File

@@ -126,6 +126,7 @@
local.lib.mkModules
[
./modules/boot/fileSystems.nix
./modules/boot/kernel.nix
(inputs: { config.nixos =
{
fileSystems =
@@ -150,6 +151,10 @@
resume = "/dev/mapper/swap";
rollingRootfs = { device = "/dev/mapper/root"; path = "/nix/rootfs"; };
};
kernel =
{
cpu = [ "intel" ];
};
};}
)

View File

@@ -2,21 +2,6 @@ inputs:
{
config =
{
# filesystem mount
# sudo btrfs fi mkswapfile --size 64g --uuid clear swap
# sudo btrfs inspect-internal map-swapfile -r swap
# sudo mdadm --create /dev/md/swap --level 0 --raid-devices 2 /dev/nvme1n1p5 /dev/nvme0n1p5
# sudo mkswap --uuid clear /dev/md/swap
# sudo cryptsetup luksFormat /dev/md/swap
# sudo systemd-cryptenroll --fido2-device=auto /dev/md/swap
# sudo systemd-cryptenroll --wipe-slot=0 /dev/md/swap
# sudo $(dirname $(realpath $(which systemctl)))/../lib/systemd/systemd-cryptsetup \
# attach swap /dev/md/swap - fido2-device=auto
# sudo mkswap --uuid clear /dev/mapper/swap
# kernel, modules, ucode
boot.kernelPackages = inputs.pkgs.linuxPackages_xanmod_latest;
hardware.cpu.intel.updateMicrocode = true;
# modules auto loaded in stage2
boot.kernelModules = [ "kvm-intel" "br_netfilter" ];
# modules install but not auto loaded

14
modules/boot/kernel.nix Normal file
View File

@@ -0,0 +1,14 @@
{ pkgs, ... }@inputs:
{
options.nixos.kernel = let inherit (inputs.lib) mkOption types; in
{
cpu = mkOption { type = types.listOf (types.enum [ "intel" "amd" ]); default = []; };
};
config =
{
boot.kernelPackages = inputs.pkgs.linuxPackages_xanmod_latest;
hardware.cpu = builtins.listToAttrs (builtins.map
(name: { inherit name; value = { updateMicrocode = true; }; })
inputs.config.nixos.kernel.cpu);
};
}