diff --git a/hosts/del/configuration.nix b/hosts/del/configuration.nix index 18cd3c50..258a9899 100644 --- a/hosts/del/configuration.nix +++ b/hosts/del/configuration.nix @@ -266,55 +266,32 @@ daemon.enable = false; agent = { enable = true; - hostAliases = let - username = config.myOptions.other.system.username; - hmCfg = config.home-manager.users.${username}; - in { - "github" = { - hostName = "github.com"; - identityFile = "${hmCfg.home.homeDirectory}/.ssh/githubkey"; - }; - "git.dupa.edu.pl" = { - hostName = "git.dupa.edu.pl"; - identityFile = "${hmCfg.home.homeDirectory}/.ssh/gitdupaedupl"; - }; - "codeberg" = { - hostName = "codeberg.org"; - identityFile = "${hmCfg.home.homeDirectory}/.ssh/codeberg"; - }; - "gitlab" = { - hostName = "gitlab.com"; - identityFile = "${hmCfg.home.homeDirectory}/.ssh/gitlab"; - }; + hostAliases = { + "github".hostName = "github.com"; + "git.dupa.edu.pl".hostName = "git.dupa.edu.pl"; + "codeberg".hostName = "codeberg.org"; + "gitlab".hostName = "gitlab.com"; "aur" = { hostName = "aur.archlinux.org"; user = "aur"; - identityFile = "${hmCfg.home.homeDirectory}/.ssh/aur"; }; "jacekpoz" = { hostName = "git.jacekpoz.pl"; user = "forgejo"; - identityFile = "${hmCfg.home.homeDirectory}/.ssh/jacekpoz"; }; "chmura" = { hostName = "192.168.15.2"; user = "chmura"; - identityFile = "${hmCfg.home.homeDirectory}/.ssh/chmura"; }; "chmura2" = { hostName = "jacekpoz.pl"; user = "chmura"; - identityFile = "${hmCfg.home.homeDirectory}/.ssh/chmura"; }; "malina" = { hostName = "192.168.15.3"; user = "malina"; - identityFile = "${hmCfg.home.homeDirectory}/.ssh/malina"; - }; - "outfoxxed" = { - hostName = "git.outfoxxed.me"; - identityFile = "${hmCfg.home.homeDirectory}/.ssh/outfoxxed"; }; + "outfoxxed".hostName = "git.outfoxxed.me"; }; }; }; diff --git a/hosts/niks/configuration.nix b/hosts/niks/configuration.nix index 85ffd704..d8366d93 100644 --- a/hosts/niks/configuration.nix +++ b/hosts/niks/configuration.nix @@ -237,55 +237,32 @@ daemon.enable = false; agent = { enable = true; - hostAliases = let - username = config.myOptions.other.system.username; - hmCfg = config.home-manager.users.${username}; - in { - "github" = { - hostName = "github.com"; - identityFile = "${hmCfg.home.homeDirectory}/.ssh/githubkey"; - }; - "git.dupa.edu.pl" = { - hostName = "git.dupa.edu.pl"; - identityFile = "${hmCfg.home.homeDirectory}/.ssh/gitdupaedupl"; - }; - "codeberg" = { - hostName = "codeberg.org"; - identityFile = "${hmCfg.home.homeDirectory}/.ssh/codeberg"; - }; - "gitlab" = { - hostName = "gitlab.com"; - identityFile = "${hmCfg.home.homeDirectory}/.ssh/gitlab"; - }; + hostAliases = { + "github".hostName = "github.com"; + "git.dupa.edu.pl".hostName = "git.dupa.edu.pl"; + "codeberg".hostName = "codeberg.org"; + "gitlab".hostName = "gitlab.com"; "aur" = { hostName = "aur.archlinux.org"; user = "aur"; - identityFile = "${hmCfg.home.homeDirectory}/.ssh/aur"; }; "jacekpoz" = { hostName = "git.jacekpoz.pl"; user = "forgejo"; - identityFile = "${hmCfg.home.homeDirectory}/.ssh/jacekpoz"; }; "chmura" = { hostName = "192.168.15.2"; user = "chmura"; - identityFile = "${hmCfg.home.homeDirectory}/.ssh/chmura"; }; "chmura2" = { hostName = "jacekpoz.pl"; user = "chmura"; - identityFile = "${hmCfg.home.homeDirectory}/.ssh/chmura"; }; "malina" = { hostName = "192.168.15.3"; user = "malina"; - identityFile = "${hmCfg.home.homeDirectory}/.ssh/malina"; - }; - "outfoxxed" = { - hostName = "git.outfoxxed.me"; - identityFile = "${hmCfg.home.homeDirectory}/.ssh/outfoxxed"; }; + "outfoxxed".hostName = "git.outfoxxed.me"; }; }; }; diff --git a/modules/services/ssh.nix b/modules/services/ssh.nix index 6135daf4..eb47d1bd 100644 --- a/modules/services/ssh.nix +++ b/modules/services/ssh.nix @@ -50,12 +50,13 @@ in { }; identityFile = mkOption { description = "path to the private key"; - type = types.path; + type = with types; nullOr path; + default = null; }; identitiesOnly = mkOption { description = "whether ssh should not use additional identities offered by ssh-agent"; type = types.bool; - default = true; + default = false; }; }; }); @@ -87,7 +88,7 @@ in { HostName ${value.hostName} ${if value.port != null then "Port ${toString value.port}" else ""} User ${value.user} - IdentityFile ${value.identityFile} + ${if value.identityFile != null then "IdentityFile ${value.identityFile}" else ""} IdentitiesOnly ${if value.identitiesOnly then "yes" else "no"} '') cfg.agent.hostAliases)} '';