Files
nixos/home/ssh.nix

21 lines
728 B
Nix
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{ config, lib, ... }:
let
# 与 modules/core/sops.nix 保持同一开关secrets 文件存在时才启用。
secretsEnabled = builtins.pathExists ../../secrets/users/luochen570.enc.yaml;
in
{
programs.ssh.enable = true;
# 26.05: 显式关闭默认配置生成,避免未来默认值移除警告
programs.ssh.enableDefaultConfig = false;
home.file = lib.mkIf secretsEnabled {
# ~/.ssh/id_rsa 来自 sops secret 文件。
".ssh/id_rsa".source =
config.lib.file.mkOutOfStoreSymlink "/run/secrets/users/luochen570/ssh_private_key";
# ~/.ssh/config 来自 sops secret 文件。
".ssh/config".source =
config.lib.file.mkOutOfStoreSymlink "/run/secrets/users/luochen570/ssh_config";
};
}