separate ssh client and server config and move to common

This commit is contained in:
wo2wz 2025-08-09 11:40:41 -04:00
parent 7c29e984ae
commit 496a9ac3bc
4 changed files with 25 additions and 14 deletions

View file

@ -2,6 +2,8 @@
{
imports = [
./ssh
./boot.nix
./home-manager.nix
./locales.nix

26
common/ssh/client.nix Executable file
View file

@ -0,0 +1,26 @@
{ config, pkgs, ... }:
{
programs.ssh = {
startAgent = true;
enableAskPassword = true;
extraConfig = "
IdentityFile /home/wo2w/.ssh/ssh-key
User wo2w
Host gameserver
Hostname 192.168.2.221
Port 22
Host Swordsmachine
Hostname 192.168.2.84
Port 8743
Host Earthmover
Hostname 192.168.2.87
Port 8743
";
};
environment = {
systemPackages = if config.services.desktopManager.plasma6.enable then with pkgs; [ kdePackages.ksshaskpass ] else [];
variables.SSH_ASKPASS_REQUIRE = "prefer";
};
}

8
common/ssh/default.nix Normal file
View file

@ -0,0 +1,8 @@
{ config, ... }:
{
imports = [
./client.nix
./server.nix
];
}

14
common/ssh/server.nix Normal file
View file

@ -0,0 +1,14 @@
{ config, ... }:
{
services.openssh = {
enable = true;
ports = [ 8743 ];
settings = {
PasswordAuthentication = false;
KbdInteractiveAuthentication = false;
PermitRootLogin = "no";
AllowUsers = [ "wo2w" ];
};
};
}