2023-01-06 15:38:29 +00:00
|
|
|
{ config, lib, pkgs, sane-lib, ... }:
|
2022-11-22 05:28:41 +00:00
|
|
|
|
2023-01-06 15:05:01 +00:00
|
|
|
let
|
|
|
|
host = config.networking.hostName;
|
|
|
|
user_pubkey = (import ../pubkeys.nix).users."${host}";
|
|
|
|
known_hosts_text = builtins.concatStringsSep
|
|
|
|
"\n"
|
|
|
|
(builtins.attrValues (import ../pubkeys.nix).hosts);
|
|
|
|
in lib.mkIf config.sane.home-manager.enable {
|
|
|
|
# ssh key is stored in private storage
|
|
|
|
sane.persist.home.private = [ ".ssh/id_ed25519" ];
|
2023-01-06 15:38:29 +00:00
|
|
|
sane.fs."/home/colin/.ssh/id_ed25519.pub" = sane-lib.fs.wantedText user_pubkey;
|
2022-10-25 12:17:28 +00:00
|
|
|
|
2023-01-06 15:05:01 +00:00
|
|
|
home-manager.users.colin = {
|
2022-10-25 12:17:28 +00:00
|
|
|
programs.ssh.enable = true;
|
|
|
|
# this optionally accepts multiple known_hosts paths, separated by space.
|
|
|
|
programs.ssh.userKnownHostsFile = builtins.toString (pkgs.writeText "known_hosts" known_hosts_text);
|
2022-10-25 12:06:33 +00:00
|
|
|
};
|
|
|
|
}
|