feat(ssh): add enable option

This commit is contained in:
2026-05-22 10:23:22 +02:00
parent a5adea70ea
commit 086e091add
8 changed files with 93 additions and 70 deletions

View File

@@ -59,6 +59,7 @@
shell.bash.aliases.lang-js = true;
shell.bash.addBinToPath = true;
audio.enable = true;
ssh.enable = true;
music.enable = true;
terminal.enable = true;
devenv.enable = true;

View File

@@ -56,6 +56,7 @@
shell.bash.addBinToPath = true;
my.yubikey.enable = true;
audio.enable = true;
ssh.enable = true;
music.enable = true;
terminal.enable = true;
devenv.enable = true;

View File

@@ -1,10 +1,13 @@
{
myUtils,
config,
lib,
pkgs,
myUtils,
...
}:
let
cfg = config.ssh;
hostDir = ../../hosts;
hostNames = myUtils.dirNames hostDir;
hostsWithKeys = lib.filter (
@@ -12,31 +15,35 @@ let
) hostNames;
in
{
home.packages = with pkgs; [ sshfs ];
options.ssh.enable = lib.mkEnableOption "ssh";
programs.ssh = {
enable = true;
enableDefaultConfig = false;
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [ sshfs ];
matchBlocks =
lib.genAttrs hostsWithKeys (
hostname:
let
meta = myUtils.hostMeta (hostDir + "/${hostname}");
in
{
host = hostname;
user = meta.deployment.targetUser;
}
// lib.optionalAttrs (meta.deployment.targetHost != "") {
hostname = meta.deployment.targetHost;
}
)
// {
"*" = {
addKeysToAgent = "yes";
forwardAgent = false;
programs.ssh = {
enable = true;
enableDefaultConfig = false;
matchBlocks =
lib.genAttrs hostsWithKeys (
hostname:
let
meta = myUtils.hostMeta (hostDir + "/${hostname}");
in
{
host = hostname;
user = meta.deployment.targetUser;
}
// lib.optionalAttrs (meta.deployment.targetHost != "") {
hostname = meta.deployment.targetHost;
}
)
// {
"*" = {
addKeysToAgent = "yes";
forwardAgent = false;
};
};
};
};
};
}