nixos/modules/system/initrd.nix

25 lines
693 B
Nix
Raw Normal View History

2023-09-02 15:07:16 +08:00
inputs:
{
options.nixos.system.initrd = let inherit (inputs.lib) mkOption types; in
{
network.enable = mkOption { type = types.bool; default = false; };
sshd =
{
enable = mkOption { type = types.bool; default = false; };
hostKeys = mkOption { type = types.listOf types.nonEmptyStr; default = []; };
};
};
config =
let
inherit (inputs.config.nixos.system) initrd;
in { boot =
{
initrd =
{
systemd.enable = true;
2023-11-16 15:51:47 +08:00
network = { enable = initrd.network.enable; ssh = { enable = true; hostKeys = initrd.sshd.hostKeys; }; };
2023-09-02 15:07:16 +08:00
};
kernelParams = if initrd.network.enable then [ "ip=dhcp" ] else [];
};};
}