fmt
This commit is contained in:
@@ -3,12 +3,14 @@
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkOption types;
|
||||
cfg = config.nixos.boot.kernel;
|
||||
|
||||
hasHardware = hw: builtins.elem hw cfg.hardware;
|
||||
in {
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
./security.nix
|
||||
];
|
||||
@@ -16,26 +18,36 @@ in {
|
||||
options = {
|
||||
nixos.boot.kernel = {
|
||||
variant = mkOption {
|
||||
type = types.enum ["stable" "latest" "cachyos"];
|
||||
type = types.enum [
|
||||
"stable"
|
||||
"latest"
|
||||
"cachyos"
|
||||
];
|
||||
default = "latest";
|
||||
description = "Kernel variant to use.";
|
||||
};
|
||||
|
||||
hardware = mkOption {
|
||||
type = types.listOf (types.enum ["amd" "intel" "nvidia"]);
|
||||
default = [];
|
||||
type = types.listOf (
|
||||
types.enum [
|
||||
"amd"
|
||||
"intel"
|
||||
"nvidia"
|
||||
]
|
||||
);
|
||||
default = [ ];
|
||||
description = "List of hardware types (e.g. GPU and CPU vendors) to configure kernel settings for.";
|
||||
};
|
||||
|
||||
extraKernelParams = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
default = [ ];
|
||||
description = "Additional kernel parameters.";
|
||||
};
|
||||
|
||||
extraBlacklistedModules = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
default = [ ];
|
||||
description = "Additional kernel modules to blacklist.";
|
||||
};
|
||||
};
|
||||
@@ -45,52 +57,32 @@ in {
|
||||
boot = {
|
||||
consoleLogLevel = 3;
|
||||
|
||||
kernelPackages = let
|
||||
variant = cfg.variant or "latest";
|
||||
in
|
||||
if variant == "stable"
|
||||
then pkgs.linuxPackages
|
||||
else if variant == "latest"
|
||||
then pkgs.linuxPackages_latest
|
||||
else if variant == "cachyos"
|
||||
then pkgs.linuxPackages_cachyos
|
||||
else throw "Unknown kernel variant: ${variant}";
|
||||
kernelPackages =
|
||||
let
|
||||
variant = cfg.variant or "latest";
|
||||
in
|
||||
if variant == "stable" then
|
||||
pkgs.linuxPackages
|
||||
else if variant == "latest" then
|
||||
pkgs.linuxPackages_latest
|
||||
else if variant == "cachyos" then
|
||||
pkgs.linuxPackages_cachyos
|
||||
else
|
||||
throw "Unknown kernel variant: ${variant}";
|
||||
|
||||
kernelParams =
|
||||
["quiet" "splash"]
|
||||
++ (
|
||||
if hasHardware "amd"
|
||||
then ["amd_pstate=active"]
|
||||
else []
|
||||
)
|
||||
++ (
|
||||
if hasHardware "intel"
|
||||
then []
|
||||
else []
|
||||
)
|
||||
++ (
|
||||
if hasHardware "nvidia"
|
||||
then []
|
||||
else []
|
||||
)
|
||||
++ cfg.extraKernelParams;
|
||||
kernelParams = [
|
||||
"quiet"
|
||||
"splash"
|
||||
]
|
||||
++ (if hasHardware "amd" then [ "amd_pstate=active" ] else [ ])
|
||||
++ (if hasHardware "intel" then [ ] else [ ])
|
||||
++ (if hasHardware "nvidia" then [ ] else [ ])
|
||||
++ cfg.extraKernelParams;
|
||||
|
||||
blacklistedKernelModules =
|
||||
(
|
||||
if hasHardware "amd"
|
||||
then []
|
||||
else []
|
||||
)
|
||||
++ (
|
||||
if hasHardware "intel"
|
||||
then []
|
||||
else []
|
||||
)
|
||||
++ (
|
||||
if hasHardware "nvidia"
|
||||
then ["nouveau"]
|
||||
else []
|
||||
)
|
||||
(if hasHardware "amd" then [ ] else [ ])
|
||||
++ (if hasHardware "intel" then [ ] else [ ])
|
||||
++ (if hasHardware "nvidia" then [ "nouveau" ] else [ ])
|
||||
++ cfg.extraBlacklistedModules;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
"net.core.default_qdisc" = "cake";
|
||||
};
|
||||
|
||||
boot.kernelModules = ["tcp_bbr"];
|
||||
boot.kernelModules = [ "tcp_bbr" ];
|
||||
|
||||
security = {
|
||||
# pam.services.hyprlock.text = "auth include login";
|
||||
|
||||
@@ -4,10 +4,17 @@
|
||||
config,
|
||||
inputs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkEnableOption mkMerge mkForce;
|
||||
}:
|
||||
let
|
||||
inherit (lib)
|
||||
mkIf
|
||||
mkEnableOption
|
||||
mkMerge
|
||||
mkForce
|
||||
;
|
||||
cfg = config.nixos.boot.loader;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options = {
|
||||
nixos.boot.loader = {
|
||||
default = {
|
||||
@@ -54,7 +61,7 @@ in {
|
||||
loader.systemd-boot.enable = mkForce false;
|
||||
};
|
||||
|
||||
environment.systemPackages = [pkgs.sbctl];
|
||||
environment.systemPackages = [ pkgs.sbctl ];
|
||||
})
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user