2023-09-10 14:12:01 +02:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}: let
|
|
|
|
cfg = config.my.server;
|
|
|
|
in {
|
|
|
|
options.my.server = {
|
|
|
|
enable = lib.mkEnableOption "server role";
|
|
|
|
};
|
|
|
|
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
services = {
|
2023-09-11 19:16:26 +02:00
|
|
|
# Enable the OpenSSH daemon.
|
2023-09-11 19:17:32 +02:00
|
|
|
openssh = {
|
2023-09-11 19:16:26 +02:00
|
|
|
enable = true;
|
|
|
|
settings = {
|
|
|
|
# PermitRootLogin = "no"; # this is managed through authorized keys
|
|
|
|
PasswordAuthentication = false;
|
|
|
|
KbdInteractiveAuthentication = false;
|
|
|
|
};
|
|
|
|
};
|
2023-09-10 14:12:01 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
programs = {
|
2023-09-11 19:16:26 +02:00
|
|
|
git.enable = true;
|
|
|
|
zsh.enable = true;
|
2023-09-10 14:12:01 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
networking.firewall = {
|
2023-09-11 19:16:26 +02:00
|
|
|
enable = true;
|
2023-09-10 14:12:01 +02:00
|
|
|
allowedTCPPortRanges = [
|
|
|
|
{
|
|
|
|
# ssh
|
|
|
|
from = 22;
|
|
|
|
to = 22;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
2023-09-11 19:16:26 +02:00
|
|
|
|
|
|
|
environment = {
|
|
|
|
systemPackages = with pkgs; [
|
|
|
|
ncdu
|
2023-09-11 21:42:33 +02:00
|
|
|
htop
|
2023-09-11 19:16:26 +02:00
|
|
|
];
|
|
|
|
};
|
2023-09-10 14:12:01 +02:00
|
|
|
};
|
|
|
|
}
|