all repos — dotfiles @ 1f1f5f5427a96a94a5d2e38e7e116656ce753a7c

my *nix dotfiles

nix/sini: enable wireless ssh in initrd
Anirudh Oppiliappan x@icyphox.sh
Fri, 05 Jul 2024 12:20:33 +0300
commit

1f1f5f5427a96a94a5d2e38e7e116656ce753a7c

parent

b7579dcf676d73456debd4280c6f11eb5d21f648

1 files changed, 33 insertions(+), 0 deletions(-)

jump to
M hosts/sini/configuration.nixhosts/sini/configuration.nix

@@ -12,6 +12,39 @@

boot.initrd.luks.devices."luks-0ae4be28-55a1-4a0c-8518-c6d53540cb26".device = "/dev/disk/by-uuid/0ae4be28-55a1-4a0c-8518-c6d53540cb26"; networking.hostName = "sini"; # Define your hostname. + boot.kernelParams = [ "ip=dhcp" ]; + boot.initrd = let interface = "wlp3s0"; in + { + availableKernelModules = [ "ccm" "ctr" "iwlmvm" "iwlwifi" ]; + + systemd = { + enable = true; + + packages = [ pkgs.wpa_supplicant ]; + initrdBin = [ pkgs.wpa_supplicant ]; + targets.initrd.wants = [ "wpa_supplicant@${interface}.service" ]; + + # prevent WPA supplicant from requiring `sysinit.target`. + services."wpa_supplicant@".unitConfig.DefaultDependencies = false; + + users.root.shell = "/bin/systemd-tty-ask-password-agent"; + + network = { + enable = true; + ssh = { + enable = true; + port = 22; + authorizedKeys = [ "ssh-rsa AAAAyourpublic-key-here..." ]; + hostKeys = [ "/etc/secrets/initrd/ssh_host_rsa_key" ]; + }; + networks = { + matchConfig.Name = interface; + networkConfig.DHCP = "yes"; + }; + }; + }; + }; + networking.networkmanager.enable = true; time.timeZone = "Europe/Helsinki";