Add ssh configuration

This commit is contained in:
Kevin Kandlbinder 2022-12-21 13:50:22 +01:00
parent a46d297fc7
commit 2e48cc8833
5 changed files with 49 additions and 6 deletions

21
nixos/modules/ssh.nix Normal file
View file

@ -0,0 +1,21 @@
{ lib, pkgs, config, ... }:
with lib;
let
cfg = config.kevin.ssh;
in {
options.kevin.ssh = {
server.enable = mkEnableOption "kevins ssh";
authorized.kevin = mkEnableOption "set authorized for kevin";
};
config = mkMerge [
(mkIf cfg.server.enable {
kevin.networking.ssh.enable = true;
})
(mkIf cfg.authorized.kevin {
users.users."kevin".openssh.authorizedKeys.keyFiles = [
/etc/nixos/ssh/kevin/authorized_keys
];
})
];
}