2021-02-08 13:42:35 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
{
|
|
|
|
# Kernel configuration
|
|
|
|
boot = {
|
|
|
|
kernelPackages = pkgs.linuxPackages;
|
|
|
|
kernelModules = [ "kvm-amd" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
# Bootloader configuration
|
|
|
|
boot.loader = {
|
|
|
|
efi.canTouchEfiVariables = true;
|
|
|
|
systemd-boot = {
|
|
|
|
enable = true;
|
|
|
|
configurationLimit = 50;
|
|
|
|
};
|
|
|
|
timeout = 3;
|
|
|
|
};
|
|
|
|
|
2021-03-15 11:10:04 +01:00
|
|
|
# Packages
|
2021-03-29 19:32:04 +02:00
|
|
|
environment.systemPackages = with pkgs; [ htop vim zip unzip ];
|
2021-03-15 11:10:04 +01:00
|
|
|
|
2021-02-08 13:42:35 +01:00
|
|
|
# Run Nix garbage collector, while avoiding compiling
|
|
|
|
nix = {
|
|
|
|
autoOptimiseStore = true;
|
|
|
|
gc = {
|
|
|
|
automatic = true;
|
2021-03-15 11:18:10 +01:00
|
|
|
options = "--delete-older-than 14d";
|
2021-02-08 13:42:35 +01:00
|
|
|
};
|
|
|
|
extraOptions = ''
|
|
|
|
keep-outputs = true
|
|
|
|
keep-derivations = true
|
|
|
|
gc-keep-outputs = true
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
# Clean tmp directory on shutdown
|
|
|
|
boot.cleanTmpDir = true;
|
|
|
|
|
|
|
|
# Rotate logs after 14 days
|
|
|
|
services.journald.extraConfig = "SystemMaxFiles=14";
|
|
|
|
|
|
|
|
# Scrub zpool monthly
|
|
|
|
services.zfs.autoScrub = {
|
|
|
|
enable = true;
|
|
|
|
interval = "monthly";
|
|
|
|
};
|
|
|
|
|
|
|
|
# Set timezone and synchronize NTP
|
|
|
|
time.timeZone = "Europe/Brussels";
|
2021-03-12 17:43:51 +01:00
|
|
|
services.timesyncd.enable = true;
|
2021-02-08 13:42:35 +01:00
|
|
|
|
|
|
|
# NixOS version
|
|
|
|
system.stateVersion = "20.09";
|
|
|
|
|
2021-03-15 11:07:54 +01:00
|
|
|
# Configure basic SSH access
|
|
|
|
services.openssh = {
|
|
|
|
enable = true;
|
|
|
|
permitRootLogin = "yes";
|
2021-03-31 10:08:58 +02:00
|
|
|
macs = [
|
|
|
|
"hmac-sha2-512-etm@openssh.com"
|
|
|
|
"hmac-sha2-256-etm@openssh.com"
|
|
|
|
"umac-128-etm@openssh.com"
|
|
|
|
"hmac-sha2-512"
|
|
|
|
"hmac-sha2-256"
|
|
|
|
"umac-128@openssh.com"
|
|
|
|
"hmac-sha1"
|
|
|
|
];
|
|
|
|
kexAlgorithms = [
|
|
|
|
"curve25519-sha256@libssh.org"
|
|
|
|
"diffie-hellman-group-exchange-sha256"
|
|
|
|
"diffie-hellman-group1-sha1"
|
|
|
|
];
|
2021-03-15 11:07:54 +01:00
|
|
|
};
|
|
|
|
|
2021-03-12 17:43:51 +01:00
|
|
|
# Create coace user
|
2021-02-08 13:42:35 +01:00
|
|
|
users.users.coace = {
|
|
|
|
isNormalUser = true;
|
|
|
|
home = "/home/coace";
|
|
|
|
extraGroups = [ "wheel" "libvirtd" ];
|
|
|
|
shell = pkgs.fish;
|
|
|
|
openssh.authorizedKeys.keys = [
|
|
|
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAbHBpW1JgArO7XFr3mqMD8nCf3RjkHzso+mpNjR8iZi coolneng@panacea"
|
2021-03-31 10:26:06 +02:00
|
|
|
"ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAstGGn6Ri+LtR6ffPrRgFcLF1fJFRIyz2WrbYMjQRNGdYyr/01TSmh0N2DLapDPhHAiKk7M5qHc9ltSZxWS4zQIkKAVWhyeGbvc/Yya/T8Yy04ltm2XZQEKx92dFhQMBUhDKc/Sp/JQy+jmvzWDL/bt7tmAOzXvVElEaeapvlhaihlwrH1EqTgV44x08MVlOcDJLSEJqCwj1OsD6zT1D58TCc/VawNh9DXJm7MK/1OhesziRFXKR9Wzr0zYcTjYe78ISpILZeilxFA08TQrua51kHIEL/BznXN+IRRIXrhDqQIWkdJTEMIC83//jbOoePvJ7sjrrS2VZwEOg0N+zt+Q== root@sica"
|
2021-02-08 13:42:35 +01:00
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
# Set shell and SSH for root user
|
|
|
|
users.users.root = {
|
|
|
|
shell = pkgs.fish;
|
|
|
|
openssh.authorizedKeys.keys = [
|
|
|
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAbHBpW1JgArO7XFr3mqMD8nCf3RjkHzso+mpNjR8iZi coolneng@panacea"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
# Auto-upgrade the system
|
|
|
|
system.autoUpgrade = {
|
|
|
|
enable = true;
|
|
|
|
allowReboot = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
# Import other configuration modules
|
|
|
|
imports = [
|
|
|
|
./modules/hardware-configuration.nix
|
|
|
|
./modules/networking.nix
|
|
|
|
./modules/datasync.nix
|
2021-03-15 12:08:59 +01:00
|
|
|
./modules/virtualization.nix
|
2021-03-15 14:00:59 +01:00
|
|
|
./modules/monitoring.nix
|
2021-03-30 12:07:20 +02:00
|
|
|
./modules/periodic.nix
|
2021-04-07 13:18:31 +02:00
|
|
|
./modules/webstack.nix
|
2021-06-25 15:09:27 +02:00
|
|
|
./modules/email.nix
|
2021-02-08 13:42:35 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
}
|