dotfiles/home-manager/programs/ssh.nix

101 lines
2.2 KiB
Nix
Raw Permalink Normal View History

2024-06-04 22:26:37 +02:00
{ lib, ... }:
let
ownDomains = [
"thilo-billerbeck.com"
"avocadoom.de"
"officerent.de"
];
thiloBillerbeckHosts = [
"lisa"
"bart"
"burns"
"homer"
"marge"
"apu"
"krusty"
"skinner"
];
manualMatchBlocks = {
"github.com" = {
identityFile = "~/.ssh/id_github-com";
user = "git";
identitiesOnly = true;
};
"mail" = { hostname = "mail.officerent.de"; };
"*.tu-darmstadt.de" = {
identityFile = "~/.ssh/id_tu-darmstadt-de";
};
"*.rwth-aachen.de" = {
identityFile = "~/.ssh/id_tu-darmstadt-de";
};
"*.tobias-neidig.de" = {
identityFile = "~/.ssh/id_tobias-neidig-de";
};
"*.darmstadt.ccc.de" = {
identityFile = "~/.ssh/id_darmstadt-ccc-de";
};
"*.relaix.net" = {
identityFile = "~/.ssh/id_relaix-net";
user = "tbillerbeck";
};
"*.w17.io" = {
user = "chaos";
identityFile = "~/.ssh/id_w17";
};
"*.tailscale.net" = {
user = "thilo";
identityFile = "~/.ssh/id_tailscale";
};
"ssh.dev.azure.com" = {
identityFile = "~/.ssh/id_azure-com";
identitiesOnly = true;
extraOptions = {
HostkeyAlgorithms = "+ssh-rsa";
PubkeyAcceptedKeyTypes = "+ssh-rsa";
};
};
2024-07-22 20:23:58 +02:00
"flanders" = {
identityFile = "~/.ssh/id_thilo-billerbeck-com";
user = "thilo";
};
2024-06-04 22:26:37 +02:00
};
catchAlls = builtins.listToAttrs (
2024-07-22 20:23:58 +02:00
builtins.map
(host: {
name = "*.${host}";
value = {
identityFile = "~/.ssh/id_thilo-billerbeck-com";
user = "root";
};
})
ownDomains
2024-06-04 22:26:37 +02:00
);
hostnameAliasses = builtins.listToAttrs (
2024-07-22 20:23:58 +02:00
builtins.map
(host: {
name = "${host}";
value = {
hostname = "${host}.thilo-billerbeck.com";
};
})
thiloBillerbeckHosts
2024-06-04 22:26:37 +02:00
);
buildersCCCDA = builtins.listToAttrs (
2024-07-22 20:23:58 +02:00
builtins.map
(host: {
name = "build${host}.darmstadt.ccc.de";
value = {
user = "avocadoom";
2024-06-04 22:26:37 +02:00
identityFile = "~/.ssh/id_darmstadt-ccc-de";
2024-07-22 20:23:58 +02:00
};
}) [ "1" "2" "3" "4" ]
2024-06-04 22:26:37 +02:00
);
in
{
programs.ssh = {
enable = true;
2024-07-22 20:23:58 +02:00
matchBlocks = manualMatchBlocks // catchAlls // hostnameAliasses;
2024-06-04 22:26:37 +02:00
};
}