This repository has been archived on 2023-08-08. You can view files and clone it, but cannot push or open issues or pull requests.
nil/modules/system/ssh.nix
2022-08-13 23:10:13 -04:00

29 lines
630 B
Nix

{ config, lib, pkgs, ... }:
#with lib.my;
with lib;
let
this = config.my.system.ssh;
publicKey = pkgs.fetchurl {
url = "https://github.com/jamesepatrick.keys";
sha256 = "sha256-alm6KRFca4VjzTyVEg+j1s0uKaSfvV76o3sgYNAisSA=";
};
in {
options.my = {
system.ssh.enable = mkOption {
default = true;
type = with types; bool;
};
};
config = mkIf this.enable {
# Openssh settings for security
services.openssh = {
enable = true;
permitRootLogin = "no";
passwordAuthentication = false;
};
users.users.james.openssh.authorizedKeys.keyFiles = [ publicKey ];
};
}