summaryrefslogtreecommitdiff
path: root/os/core/ssh.nix
blob: a0cb1f48a6cf273eec49103372d9056dbd21a3b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{
  config,
  lib,
  pkgs,
  username,
  ...
}:
let
  cfg = config.os.core.ssh;
in
{
  options.os.core.ssh.enable = lib.mkEnableOption "enables ssh server setup";

  config = lib.mkIf cfg.enable {
    services.openssh = {
      enable = true;
      settings = {
        PasswordAuthentication = false;
        KbdInteractiveAuthentication = false;
      };
    };

    programs.gnupg.agent = {
      enable = true;
      enableSSHSupport = true;
      pinentryPackage = pkgs.pinentry-curses;
    };

    users.users = {
      ${username}.openssh.authorizedKeys.keys = [
        "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAID5/Mr4PLMDflZ+SoaYP9N3kRbkkh1qL5NLSgW6C7sAu adikro@disroot.org"
      ];
    };
  };
}