2023-08-01 15:35:09 +02:00
|
|
|
{ home-manager, ... }: {
|
2023-08-25 00:57:42 +02:00
|
|
|
# https://nix-community.github.io/home-manager/options.html
|
2023-08-01 15:35:09 +02:00
|
|
|
|
|
|
|
home-manager.users.caspervk = {
|
|
|
|
programs.ssh = {
|
|
|
|
enable = true;
|
2023-08-25 00:57:42 +02:00
|
|
|
# ControlMaster enables the sharing of multiple sessions over a single
|
|
|
|
# network connection. When enabled, additional sessions to the same host
|
|
|
|
# will reuse the master session's connection rather than initiating a new
|
|
|
|
# one. This is especially useful when using SCP.
|
2023-08-13 19:28:52 +02:00
|
|
|
controlMaster = "yes";
|
2024-02-24 18:17:53 +01:00
|
|
|
# ISPs in Denmark prefer the simplicity of CG-NAT and stateful firewalls
|
|
|
|
# to the mess that is IPv6. Force keepalive packets to avoid sessions
|
|
|
|
# dying. See https://news.ycombinator.com/item?id=25737611.
|
|
|
|
serverAliveInterval = 25;
|
2023-08-01 15:35:09 +02:00
|
|
|
matchBlocks = {
|
2024-02-24 14:36:33 +01:00
|
|
|
"git.caspervk.net" = {
|
|
|
|
port = 2222;
|
|
|
|
};
|
2023-08-01 15:35:09 +02:00
|
|
|
};
|
2024-03-04 00:14:42 +01:00
|
|
|
# TODO: use addKeysToAgent attribute in Home Manager 24.04 instead of
|
|
|
|
# extraConfig.
|
2023-08-13 19:28:52 +02:00
|
|
|
extraConfig = ''
|
2023-08-25 00:57:42 +02:00
|
|
|
# Add ssh keys to the agent the first time we unlock them so we don't
|
|
|
|
# have to type the password all the time.
|
2023-08-13 19:28:52 +02:00
|
|
|
AddKeysToAgent yes
|
|
|
|
'';
|
2023-08-01 15:35:09 +02:00
|
|
|
};
|
|
|
|
};
|
2023-08-13 19:28:52 +02:00
|
|
|
|
|
|
|
programs.ssh = {
|
|
|
|
startAgent = true;
|
|
|
|
};
|
2023-08-01 15:35:09 +02:00
|
|
|
}
|