2024-03-17 22:13:28 -06:00
|
|
|
{ config, lib, pkgs, timeZone, ... }:
|
|
|
|
let
|
|
|
|
srvConfig = config.serverConfig;
|
|
|
|
in
|
|
|
|
{
|
2024-03-17 22:29:41 -06:00
|
|
|
options.serverConfig= {
|
2024-03-17 22:13:28 -06:00
|
|
|
userName = lib.mkOption {
|
|
|
|
type = lib.types.str;
|
|
|
|
description = "Main username for system";
|
|
|
|
};
|
|
|
|
hostName = lib.mkOption {
|
|
|
|
type = lib.types.str;
|
|
|
|
description = "Hostname for system";
|
|
|
|
};
|
|
|
|
hostId = lib.mkOption {
|
|
|
|
type = lib.types.str;
|
|
|
|
description = "Host ID";
|
|
|
|
};
|
|
|
|
email = lib.mkOption {
|
|
|
|
type = lib.types.str;
|
|
|
|
description = "Email for server box";
|
|
|
|
};
|
|
|
|
sshEnable = lib.mkOption {
|
|
|
|
default = false;
|
|
|
|
description = "Whether to enable ssh server";
|
|
|
|
};
|
|
|
|
nfsEnable = lib.mkOption {
|
|
|
|
default = false;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
imports = [
|
|
|
|
./modules/user/main_user.nix
|
|
|
|
];
|
|
|
|
|
2024-03-17 22:16:55 -06:00
|
|
|
config = {
|
|
|
|
# Enable flakes feature
|
|
|
|
nix.settings.experimental-features = [
|
|
|
|
"nix-command" "flakes"
|
|
|
|
];
|
2024-03-17 22:13:28 -06:00
|
|
|
|
2024-03-17 22:16:55 -06:00
|
|
|
boot.loader.systemd-boot.enable = true;
|
|
|
|
boot.loader.efi.canTouchEfiVariables = true;
|
2024-03-17 22:13:28 -06:00
|
|
|
|
2024-03-17 22:16:55 -06:00
|
|
|
networking = {
|
|
|
|
hostId = srvConfig.hostId;
|
|
|
|
hostName = srvConfig.hostName; # Define your hostname.
|
|
|
|
# Pick only one of the below networking options.
|
|
|
|
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
|
|
|
|
networkmanager.enable = true; # Easiest to use and most distros use this by default.
|
|
|
|
};
|
2024-03-17 22:13:28 -06:00
|
|
|
|
2024-03-17 22:16:55 -06:00
|
|
|
time.timeZone = timeZone;
|
2024-03-17 22:13:28 -06:00
|
|
|
|
2024-03-17 22:16:55 -06:00
|
|
|
main_user = {
|
|
|
|
enable = true;
|
|
|
|
userName = srvConfig.userName;
|
|
|
|
isDesktopUser = false;
|
|
|
|
};
|
2024-03-17 22:13:28 -06:00
|
|
|
|
2024-03-17 22:25:47 -06:00
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
docker
|
|
|
|
docker-compose
|
2024-03-17 22:55:53 -06:00
|
|
|
zsh
|
2024-03-17 22:25:47 -06:00
|
|
|
];
|
|
|
|
|
2024-03-17 22:55:53 -06:00
|
|
|
programs.zsh.enable = true;
|
|
|
|
|
2024-03-17 22:16:55 -06:00
|
|
|
services.openssh = lib.mkIf srvConfig.sshEnable {
|
|
|
|
enable = true;
|
|
|
|
};
|
2024-03-17 22:13:28 -06:00
|
|
|
|
2024-03-17 22:16:55 -06:00
|
|
|
services.nfs.server = lib.mkIf srvConfig.nfsEnable {
|
|
|
|
enable = true;
|
|
|
|
exports = ''
|
2024-03-18 08:45:54 -06:00
|
|
|
/nfs_export 192.168.1.149(rw,fsid=0,no_subtree_check)
|
2024-03-17 22:16:55 -06:00
|
|
|
'';
|
|
|
|
};
|
2024-03-17 22:13:28 -06:00
|
|
|
|
2024-03-17 22:16:55 -06:00
|
|
|
networking.firewall.allowedTCPPorts = [ 2049 ];
|
2024-03-17 22:13:28 -06:00
|
|
|
|
2024-03-17 22:16:55 -06:00
|
|
|
# networking.firewall.allowedTCPPorts = [ ... ];
|
|
|
|
# networking.firewall.allowedUDPPorts = [ ... ];
|
2024-03-17 22:13:28 -06:00
|
|
|
|
2024-03-17 22:16:55 -06:00
|
|
|
system.stateVersion = "23.11"; # Did you read the comment?
|
|
|
|
};
|
2024-03-17 22:13:28 -06:00
|
|
|
}
|