more stuff
This commit is contained in:
parent
16da7ed48b
commit
25d2fc59a4
9 changed files with 58 additions and 53 deletions
|
@ -8,6 +8,5 @@
|
|||
imports = ylib.umport {
|
||||
paths = [ ./programs ];
|
||||
recursive = true;
|
||||
exclude = [ ./programs/ssh/generate_ssh_key.nix ];
|
||||
};
|
||||
}
|
||||
|
|
29
users/_common/programs/ssh.nix
Normal file
29
users/_common/programs/ssh.nix
Normal file
|
@ -0,0 +1,29 @@
|
|||
{ 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" ] ''
|
||||
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
|
||||
'';
|
||||
|
||||
programs.ssh = {
|
||||
enable = true;
|
||||
matchBlocks = {
|
||||
github = {
|
||||
hostname = "github.com";
|
||||
identityFile = age.secrets.test1.file;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
{ 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
|
||||
''
|
|
@ -1,17 +0,0 @@
|
|||
{ 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