nixos-config/home/ssh.nix

63 lines
1.4 KiB
Nix
Raw Permalink Normal View History

2022-04-10 11:54:58 +02:00
{
config,
lib,
...
}: let
inherit
(lib)
2022-01-11 16:08:21 +01:00
mkEnableOption
mkIf
2022-04-10 11:54:58 +02:00
;
2022-01-11 16:08:21 +01:00
2021-07-29 11:31:21 +02:00
cfg = config.my.home.ssh;
2022-04-10 11:54:58 +02:00
in {
2022-01-11 16:08:21 +01:00
options.my.home.ssh = {
2022-04-10 11:54:58 +02:00
enable = (mkEnableOption "ssh configuration") // {default = true;};
2021-07-29 11:31:21 +02:00
};
2022-01-11 16:08:21 +01:00
config = mkIf cfg.enable {
2021-07-29 11:31:21 +02:00
programs.ssh = {
enable = true;
matchBlocks = let
addGPGAgentForwarding = hostConf:
{
remoteForwards = [
{
# shhhh this is a path but it works
bind.address = "/run/user/1000/gnupg/S.gpg-agent.ssh";
host.address = "/run/user/1000/gnupg/S.gpg-agent.ssh";
}
];
}
// hostConf;
in {
boreal = addGPGAgentForwarding {hostname = "boreal.alarsyo.net";};
hades = addGPGAgentForwarding {hostname = "hades.alarsyo.net";};
2023-12-14 13:45:10 +01:00
thanatos = addGPGAgentForwarding {hostname = "thanatos.alarsyo.net";};
pi = addGPGAgentForwarding {
2021-08-21 12:06:09 +02:00
hostname = "pi.alarsyo.net";
user = "pi";
2021-07-29 11:31:21 +02:00
};
2021-08-01 13:33:21 +02:00
2023-12-14 13:45:10 +01:00
"thanatos.lrde.epita.fr" =
lib.hm.dag.entryBefore ["*.lrde.epita.fr"]
(addGPGAgentForwarding {
user = "alarsyo";
});
2021-08-01 13:33:21 +02:00
"*.lrde.epita.fr" = {
user = "amartin";
};
lrde-proxyjump = {
host = "*.lrde.epita.fr !ssh.lrde.epita.fr";
proxyJump = "ssh.lrde.epita.fr";
};
2021-07-29 11:31:21 +02:00
};
includes = ["prologin_config"];
2021-07-29 11:31:21 +02:00
};
};
}