2023-09-02 15:07:16 +08:00
|
|
|
inputs:
|
|
|
|
{
|
|
|
|
options.nixos.system.initrd = let inherit (inputs.lib) mkOption types; in
|
|
|
|
{
|
|
|
|
sshd =
|
|
|
|
{
|
|
|
|
enable = mkOption { type = types.bool; default = false; };
|
2023-11-19 17:29:15 +08:00
|
|
|
hostKeys = mkOption
|
|
|
|
{
|
|
|
|
type = types.listOf types.nonEmptyStr;
|
|
|
|
default = [ "/nix/persistent/etc/ssh/initrd_ssh_host_ed25519_key" ];
|
|
|
|
};
|
2023-09-02 15:07:16 +08:00
|
|
|
};
|
|
|
|
};
|
|
|
|
config =
|
|
|
|
let
|
|
|
|
inherit (inputs.config.nixos.system) initrd;
|
2023-11-19 17:29:15 +08:00
|
|
|
inherit (inputs.lib) mkIf mkMerge;
|
|
|
|
in mkMerge
|
|
|
|
[
|
|
|
|
{ boot.initrd.systemd.enable = true; }
|
|
|
|
(
|
|
|
|
mkIf (initrd.sshd.enable)
|
|
|
|
{
|
|
|
|
boot =
|
|
|
|
{
|
|
|
|
initrd.network = { enable = true; ssh = { enable = true; hostKeys = initrd.sshd.hostKeys; }; };
|
|
|
|
kernelParams = [ "ip=dhcp" ];
|
|
|
|
};
|
|
|
|
}
|
|
|
|
)
|
|
|
|
];
|
2023-09-02 15:07:16 +08:00
|
|
|
}
|