mirror of
https://github.com/aviallon/nixos-lib.git
synced 2026-04-06 01:38:06 +00:00
[Boot+Refactoring] Add a cmdline config option for cleaner boot option config
This commit is contained in:
parent
8457628ee6
commit
7e26d25066
6 changed files with 43 additions and 22 deletions
24
boot.nix
24
boot.nix
|
|
@ -22,6 +22,13 @@ let
|
|||
'';
|
||||
};
|
||||
};
|
||||
|
||||
toCmdlineValue = v: if (isBool v) then (if v then "y" else "n")
|
||||
else if (isInt v || isString v) then (toString v)
|
||||
else throw "Invalid value for kernel cmdline parameter";
|
||||
|
||||
toCmdlineList = set: mapAttrsToList (key: value: "${key}=${toCmdlineValue value}") set;
|
||||
|
||||
cfg = config.aviallon.boot;
|
||||
generalCfg = config.aviallon.general;
|
||||
allowUnfree = (types.isType types.attrs config.nixpkgs.config)
|
||||
|
|
@ -58,6 +65,13 @@ in
|
|||
example = null;
|
||||
type = types.int;
|
||||
};
|
||||
|
||||
cmdline = mkOption {
|
||||
description = "Kernel params as attributes (instead of list)";
|
||||
default = { };
|
||||
example = { "i915.fastboot" = true; };
|
||||
type = types.attrsOf (types.oneOf [ types.bool types.int types.str ]);
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
|
@ -65,14 +79,16 @@ in
|
|||
hardware.enableAllFirmware = allowUnfree;
|
||||
hardware.enableRedistributableFirmware = true;
|
||||
|
||||
aviallon.boot.cmdline = {
|
||||
"syscall.x32" = cfg.x32abi.enable;
|
||||
};
|
||||
|
||||
boot = {
|
||||
initrd.kernelModules = [ ];
|
||||
initrd.availableKernelModules = [ "ehci_pci" ];
|
||||
|
||||
kernelParams = concatLists [
|
||||
(optional cfg.x32abi.enable "syscall.x32=y")
|
||||
];
|
||||
|
||||
kernelParams = toCmdlineList cfg.cmdline;
|
||||
|
||||
kernelPatches = concatLists [
|
||||
(optional cfg.x32abi.enable customKernelPatches.enableX32ABI)
|
||||
];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue