❄️ Dotfiles for our NixOS system configuration.

refactor: change ssh logic

Chloe 65572055 b7e2820b

Changed files
+43 -1
modules
nixos
+1 -1
modules/nixos/services/default.nix
···
{
imports = [
./flatpak.nix
-
./tailscale.nix
+
./ssh.nix
];
}
+36
modules/nixos/services/ssh.nix
···
+
{ lib, config, ... }:
+
+
{
+
options.settings.ssh = {
+
enable = lib.mkOption {
+
type = lib.types.bool;
+
default = true;
+
description = "Enable SSH service";
+
};
+
+
passwordAuthentication = lib.mkOption {
+
type = lib.types.bool;
+
default = false;
+
description = "Allow password authentication";
+
};
+
+
permitRootLogin = lib.mkOption {
+
type = lib.types.str;
+
default = "no";
+
description = "Permit root login via SSH";
+
};
+
};
+
+
config = lib.mkIf config.settings.ssh.enable {
+
services.openssh = {
+
enable = true;
+
settings = {
+
PasswordAuthentication = config.settings.ssh.passwordAuthentication;
+
KbdInteractiveAuthentication = config.settings.ssh.passwordAuthentication;
+
PermitRootLogin = config.settings.ssh.permitRootLogin;
+
};
+
};
+
+
settings.firewall.allowedTCPPorts = [ 22 ];
+
};
+
}
+6
modules/nixos/users.nix
···
users.users = {
chloe = {
isNormalUser = true;
+
extraGroups = [
"networkmanager"
"wheel"
"docker"
];
+
shell = pkgs.zsh;
+
+
openssh.authorizedKeys.keys = [
+
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEJOAijXc0QNfeoCsQkaB7ybm9G+4EpFthOGy+fy+YbT"
+
];
};
};
}