nixos-configuration/modules/server/default.nix

53 lines
866 B
Nix
Raw Normal View History

2023-09-10 14:12:01 +02:00
{
config,
pkgs,
lib,
...
}: let
cfg = config.my.server;
in {
2023-09-11 19:21:31 +02:00
imports = [
../_common
];
2023-09-10 14:12:01 +02:00
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-10 14:12:01 +02:00
};
}