refactor: gate ssh sops symlinks, follow nixos-wsl, fix CRLF
- home/ssh.nix: only create /run/secrets symlinks when secrets exist - flake.nix: nixos-wsl explicit nixpkgs follows - fix CRLF line endings: nvchad.nix, virtualbox-guest.nix, docker.nix
This commit is contained in:
20
home/ssh.nix
20
home/ssh.nix
@@ -1,12 +1,18 @@
|
||||
{ config, ... }:
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
# 与 modules/core/sops.nix 保持同一开关:secrets 文件存在时才启用。
|
||||
secretsEnabled = builtins.pathExists ../../secrets/users/luochen570.enc.yaml;
|
||||
in
|
||||
{
|
||||
programs.ssh.enable = true;
|
||||
|
||||
# ~/.ssh/id_rsa 来自 sops secret 文件。
|
||||
home.file.".ssh/id_rsa".source =
|
||||
config.lib.file.mkOutOfStoreSymlink "/run/secrets/users/luochen570/ssh_private_key";
|
||||
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 文件。
|
||||
home.file.".ssh/config".source =
|
||||
config.lib.file.mkOutOfStoreSymlink "/run/secrets/users/luochen570/ssh_config";
|
||||
# ~/.ssh/config 来自 sops secret 文件。
|
||||
".ssh/config".source =
|
||||
config.lib.file.mkOutOfStoreSymlink "/run/secrets/users/luochen570/ssh_config";
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user