my nixos/home-manager configuration
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

add ssh keys automatically to ssh-agent

youn 7cd3da0c 1faab5c9

+28 -9
+28 -9
home-manager/modules/ssh.nix
··· 1 1 { 2 2 config, 3 + pkgs, 3 4 lib, 4 5 ssh, 5 6 ... ··· 20 21 matchBlocks = { 21 22 "*" = { 22 23 identityFile = [ ssh.private.path ]; 23 - setEnv = { 24 - TERM = "xterm-256color"; 25 - }; 24 + setEnv.TERM = "xterm-256color"; 26 25 }; 27 - "*.clever-cloud.com".identityFile = [ 28 - (toString config.age.secrets.clever-cloud-ssh.path) 29 - ]; 30 - "*.clvrcld.net".identityFile = [ 31 - (toString config.age.secrets.clever-cloud-ssh.path) 32 - ]; 26 + "*.clever-cloud.com" = { 27 + identityFile = [ (toString config.age.secrets.clever-cloud-ssh.path) ]; 28 + }; 29 + "*.clvrcld.net" = { 30 + identityFile = [ (toString config.age.secrets.clever-cloud-ssh.path) ]; 31 + }; 33 32 }; 34 33 }; 35 34 36 35 services.ssh-agent.enable = true; 36 + 37 + systemd.user.services."ssh-add-keys" = { 38 + Unit = { 39 + Description = "Load personal SSH keys into ssh-agent"; 40 + After = [ "ssh-agent.service" ]; 41 + Requires = [ "ssh-agent.service" ]; 42 + }; 43 + Service = { 44 + Type = "oneshot"; 45 + ExecStart = pkgs.writers.writeBash "ssh-add-keys" '' 46 + ${pkgs.openssh}/bin/ssh-add ${ 47 + lib.concatStringsSep " " [ 48 + ssh.private.path 49 + (toString config.age.secrets.clever-cloud-ssh.path) 50 + ] 51 + } 52 + ''; 53 + }; 54 + Install.WantedBy = [ "default.target" ]; 55 + }; 37 56 }; 38 57 }