nixos/modules/system/initrd.nix

29 lines
729 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;
network =
{
enable = initrd.network.enable;
ssh = { enable = true; hostKeys = initrd.sshd.hostKeys; };
};
};
kernelParams = if initrd.network.enable then [ "ip=dhcp" ] else [];
};};
}