nixos/modules/networking/ssh.nix

29 lines
645 B
Nix
Raw Normal View History

2025-06-20 11:59:24 -07:00
{ config, lib, ... }:
{
config = {
services.openssh = {
enable = true;
2025-08-12 11:58:29 -07:00
ports = [ 1173 ];
2025-06-20 11:59:24 -07:00
settings = {
PasswordAuthentication = false;
PermitRootLogin = "no";
};
};
sops.secrets."ssh_pubkeys" = {
path = "/home/${config.user}/.ssh/authorized_keys";
owner = "${config.user}";
group = "users";
mode = "0600";
};
home-manager.users.${config.user} = { pkgs, config, ... }: {
home.file.".ssh/config" = {
source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/nixos/dotfiles/ssh/${config.home.username}";
};
};
};
}