From 94a6643fc45487ad2b38a054a301273093013f47 Mon Sep 17 00:00:00 2001 From: Nathan McCarty Date: Wed, 26 Apr 2023 01:18:27 -0400 Subject: [PATCH] Refactor ssh keys --- info/ssh-keys.nix | 23 +++++++++++++++++++++++ modules/linux/user.nix | 17 ++++------------- 2 files changed, 27 insertions(+), 13 deletions(-) create mode 100644 info/ssh-keys.nix diff --git a/info/ssh-keys.nix b/info/ssh-keys.nix new file mode 100644 index 0000000..37d7f27 --- /dev/null +++ b/info/ssh-keys.nix @@ -0,0 +1,23 @@ +{ config, lib, pkgs }: rec { + keys = { + # yubikey ssh key + "yubikey" = + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILRs6zVljIlQEZ8F+aEBqqbpeFJwCw3JdveZ8TQWfkev cardno:000615938515"; + # WSL key + "wsl" = + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGXEV5lvLQ1CcPuJANv5AiYxtcRFEYXD5nODCazWnYC5 nathan@mccarty.io"; + # Phone key + "phone" = + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFR0zpmBCb0iEOeeI6SBwgucddNzccfQ5Zmdgib5iSmF nix-on-droid@localhost"; + # Tablet key + "tablet" = + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKltqneJjfdLjOvnWQC2iP7hP7aTYkURPiR8LFjB7z87 nix-on-droid@localhost"; + # Macbook key + "extremophile" = + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPLIZC4A4OhpTvfoL5jeMb1Ong9CwZ/URCYZL6y4Gp7b nathan@extremophile.local"; + # vm key + "productivity-vm" = + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMgtdTJThr5/vfUswQb3ee6A++W1OxAOGFQJTE8xDuHv nathan@productivity-vm"; + }; + list = builtins.attrValues keys; +} diff --git a/modules/linux/user.nix b/modules/linux/user.nix index 476a0a9..bca697d 100644 --- a/modules/linux/user.nix +++ b/modules/linux/user.nix @@ -1,5 +1,7 @@ { config, lib, pkgs, ... }: -let nc = config.nathan.config; +let + nc = config.nathan.config; + ssh = import ../../info/ssh-keys.nix { }; in with lib; { config = mkMerge [ { @@ -32,18 +34,7 @@ in with lib; { ]; hashedPassword = "$6$ShBAPGwzKZuB7eEv$cbb3erUqtVGFo/Vux9UwT2NkbVG9VGCxJxPiZFYL0DIc3t4GpYxjkM0M7fFnh.6V8MoSKLM/TvOtzdWbYwI58."; - openssh.authorizedKeys.keys = [ - # yubikey ssh key - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILRs6zVljIlQEZ8F+aEBqqbpeFJwCw3JdveZ8TQWfkev cardno:000615938515" - # WSL key - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGXEV5lvLQ1CcPuJANv5AiYxtcRFEYXD5nODCazWnYC5 nathan@mccarty.io" - # Phone key - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFR0zpmBCb0iEOeeI6SBwgucddNzccfQ5Zmdgib5iSmF nix-on-droid@localhost" - # Tablet key - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKltqneJjfdLjOvnWQC2iP7hP7aTYkURPiR8LFjB7z87 nix-on-droid@localhost" - # Macbook key - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPLIZC4A4OhpTvfoL5jeMb1Ong9CwZ/URCYZL6y4Gp7b nathan@extremophile.local" - ]; + openssh.authorizedKeys.keys = ssh.list; }) ]; };