29 lines
630 B
Nix
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 ];
|
||
|
};
|
||
|
}
|