wtf is happening
This commit is contained in:
parent
91e0976cda
commit
16da7ed48b
9 changed files with 58 additions and 21 deletions
15
users/_common/programs/ssh/generate_ssh_key.nix
Normal file
15
users/_common/programs/ssh/generate_ssh_key.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
{ settings, pkgs, ... }:
|
||||
''
|
||||
if [ ! -f $HOME/.ssh/id_ed25519 ]; then
|
||||
if [ -v DRY_RUN ]; then
|
||||
echo "DRY_RUN is set. Would generate SSH key for ${settings.user.username}."
|
||||
else
|
||||
echo "Generating SSH key for ${settings.user.username}."
|
||||
mkdir -p $HOME/.ssh
|
||||
chmod 700 $HOME/.ssh
|
||||
${pkgs.openssh}/bin/ssh-keygen -t ed25519 -f $HOME/.ssh/id_ed25519 -N ""
|
||||
fi
|
||||
else
|
||||
echo "SSH key already exists for ${settings.user.username}."
|
||||
fi
|
||||
''
|
17
users/_common/programs/ssh/ssh.nix
Normal file
17
users/_common/programs/ssh/ssh.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
{ lib, ... } @ args:
|
||||
{
|
||||
# We always want a standard ssh key-pair used for secret management, create it if not there.
|
||||
home.activation.generateSshKey = lib.hm.dag.entryAfter [ "writeBoundary" ] (import ./generate_ssh_key.nix args);
|
||||
|
||||
programs.ssh = {
|
||||
enable = true;
|
||||
matchBlocks = {
|
||||
github = {
|
||||
hostname = "github.com";
|
||||
# TODO lEFT OFF HERE TRYING TO GET THIS TO WORK
|
||||
# identityFile = age.secrets.test1.file;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue