summaryrefslogtreecommitdiff
path: root/os/core/ssh.nix
blob: 4f9b551f86e2effce860ae3855e463a73b040778 (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
36
37
38
{
  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.ssh.startAgent = true;
    services.gnome.gcr-ssh-agent.enable = false;

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

    users.users = {
      ${username}.openssh.authorizedKeys.keys = [
        "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIC610CJfgc3yII7MpLVqzEzQGa8Tsm+dih+CTXHXTnv4 adikro@disroot.org"
      ];
    };
  };
}