2020-05-11 06:36:55 +02:00
|
|
|
{ config, pkgs, lib, ... }: {
|
2019-10-11 14:26:37 +02:00
|
|
|
# NixOS wants to enable GRUB by default
|
|
|
|
boot.loader.grub.enable = false;
|
|
|
|
# Enables the generation of /boot/extlinux/extlinux.conf
|
|
|
|
boot.loader.generic-extlinux-compatible.enable = true;
|
2020-05-11 06:36:55 +02:00
|
|
|
|
2019-10-11 19:14:18 +02:00
|
|
|
# A bunch of boot parameters needed for optimal runtime on RPi 3B
|
2020-05-11 06:36:55 +02:00
|
|
|
boot.kernelParams = [ "cma=32M" "zfs.zfs_arc_max=134217728" ];
|
2019-10-22 22:04:06 +02:00
|
|
|
boot.loader.raspberryPi = {
|
|
|
|
enable = true;
|
|
|
|
version = 3;
|
|
|
|
uboot.enable = true;
|
|
|
|
firmwareConfig = ''
|
2020-05-09 00:22:43 +02:00
|
|
|
hdmi_force_hotplug=1
|
|
|
|
'';
|
|
|
|
};
|
2019-10-22 22:04:06 +02:00
|
|
|
|
2020-05-11 06:36:55 +02:00
|
|
|
environment.systemPackages = with pkgs; [ raspberrypi-tools git htop vim ];
|
2019-10-11 19:14:18 +02:00
|
|
|
|
2019-10-11 14:26:37 +02:00
|
|
|
# !!! Adding a swap file is optional, but strongly recommended!
|
2020-05-11 06:36:55 +02:00
|
|
|
swapDevices = [{
|
|
|
|
device = "/swapfile";
|
|
|
|
size = 1024;
|
|
|
|
}];
|
2019-10-11 19:14:18 +02:00
|
|
|
|
|
|
|
# Configure basic SSH access
|
2019-10-22 22:04:06 +02:00
|
|
|
services.openssh = {
|
|
|
|
enable = true;
|
|
|
|
permitRootLogin = "yes";
|
|
|
|
};
|
2019-10-15 00:18:57 +02:00
|
|
|
|
|
|
|
# Cleanup tmp on startup
|
|
|
|
boot.cleanTmpDir = true;
|
|
|
|
|
|
|
|
# Set hostname
|
|
|
|
networking.hostName = "zion";
|
2020-05-11 06:36:55 +02:00
|
|
|
|
2019-10-17 01:28:40 +02:00
|
|
|
# Create coolneng user
|
2019-10-16 22:17:37 +02:00
|
|
|
users.users.coolneng = {
|
|
|
|
isNormalUser = true;
|
|
|
|
home = "/home/coolneng";
|
2020-04-17 00:47:17 +02:00
|
|
|
extraGroups = [ "wheel" "lp" "scanner" "docker" ];
|
2020-05-11 06:36:55 +02:00
|
|
|
openssh.authorizedKeys.keys = [
|
|
|
|
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDL8fkFEI0+DnBJvSBSyLdOYweweaD9CUslL6cjZ3VgKh+B+SXBvNG4n3P94eHGS/lX00B66EufWCe/TtYG0mCPlhDIXnxV3TAA+aXlJEAZEwVyTqCuWgrsh0WolNBtdL/ji6ke85eeFxRP0p8WsTKNtjN5EIX+3iF6SkloO53l+hsT3sQkEXjIZ7svzQ/B+qb7+wJ35VD5InJUtiEHq29rydQF7QyBrn8Q2SF/NrtJmftjBFA6QL3STksxyW++LE8hv+2mn1LtRwY9UP8n+YaEp9R+mO3LwImvScQwvk7GbkEEbjaCanvw10h4vIB5uY8fahTkF3lUMk6O/4Poe3ar/myTvYpNEmvuKofqOMZ8uuPxhSWSjQLGvajh2JHoxVSZZwgXdG+1PBpWTO3sarVFU8GKdGHwcI5WIG63+axekyxH2NIt5H0X3HLc71TsYYcoFXeC3a19i2Y5vlsLEpbyqDWzwdE2qQFPCtTdHmUjwEEZb5Xyc9wK39doYZubu19/UoM81K5Zm1dapiAQ5SWTZjehpyd539IBXFph67Xah25QRfFEGk2xjGGNhTVQmIMUHrtkQhHDAZ1qND7XqCaUG/nOpi80MPQ0BaemDfOJyRcy3ExssO2hZ50coAShW2t+0yXNHUy0xbeBBGskQta44AcsKkAnkJL0fwBTTscREQ== coolneng@monolith"
|
|
|
|
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDFzv7R6htlqGXLWjscOxbj8nDOZLf6v61IUngSD2XvwzRGjiMhDPKxUEhkoBR5SbDAR0901Aakaf+SYxE9zpG29yncIGP9lLfs2iBBnH4ZXmsbaaEq7zhlpOHQnuT2rzwx5v1WiCZ2o57zuUm+4sd6j3pxqXGOPnVb0SaTLbIRuPR23l8zLLGdlyMF6k6iEjYQ6THuaRQBKQ7c9Cvy1dWUDdE+n7R/ESX9O1sjNVIc5zZIjsqTz4DEt6mIChNXGVHnQD+NKYpK8K+0yIYdKxoCLz0/HeMsHAM+bwl+np+ovk7tK4RKVUZ3f6d+nVm40vc2UW/UCrO4KPv3yrH4fVay5bvc0wQQwxfnSHJv3pVE0HFvZAMFQZst+6QUtttOZvF4IbhK5k/Vi3D0aMCGNa5DIAsq1wCOhR8e9oY0LAGkMyxnt0izJXNTGRXeM1EcHrxy9omU/pWaoiB7Eg0iWNgyg2UePpabknaIUo02dWdxmYV2OV/uORvClKSEvsym880= coolneng@panacea"
|
|
|
|
];
|
2020-10-28 00:38:24 +01:00
|
|
|
shell = "${pkgs.fish}/bin/fish";
|
2019-10-16 22:17:37 +02:00
|
|
|
};
|
|
|
|
|
2019-10-17 01:28:40 +02:00
|
|
|
# Set vim as default editor
|
|
|
|
programs.vim.defaultEditor = true;
|
|
|
|
|
2019-10-17 23:20:21 +02:00
|
|
|
# Set timezone and synchronize NTP
|
|
|
|
time.timeZone = "Europe/Brussels";
|
|
|
|
services.timesyncd.enable = true;
|
|
|
|
|
2020-03-29 06:21:19 +02:00
|
|
|
# Enable ZFS support
|
2019-10-18 00:31:34 +02:00
|
|
|
networking.hostId = "bb26c304";
|
2020-03-29 06:21:19 +02:00
|
|
|
boot = {
|
|
|
|
supportedFilesystems = [ "zfs" ];
|
|
|
|
zfs.extraPools = [ "vault" ];
|
|
|
|
};
|
2019-10-18 00:31:34 +02:00
|
|
|
|
|
|
|
# Scrub zpool monthly
|
2019-10-22 22:04:06 +02:00
|
|
|
services.zfs.autoScrub = {
|
|
|
|
enable = true;
|
|
|
|
interval = "monthly";
|
|
|
|
};
|
2019-10-18 00:31:34 +02:00
|
|
|
|
2019-10-18 00:04:03 +02:00
|
|
|
# Auto-upgrade the system and reboot if needed
|
2019-10-22 22:04:06 +02:00
|
|
|
system.autoUpgrade = {
|
|
|
|
enable = true;
|
2020-02-21 12:24:13 +01:00
|
|
|
allowReboot = true;
|
2019-10-23 00:51:57 +02:00
|
|
|
};
|
|
|
|
|
2020-03-29 06:21:19 +02:00
|
|
|
# Run Nix garbage collector, while avoiding compiling
|
|
|
|
nix = {
|
|
|
|
gc = {
|
|
|
|
automatic = true;
|
|
|
|
options = "--delete-older-than 30d";
|
|
|
|
};
|
|
|
|
extraOptions = ''
|
|
|
|
keep-outputs = true
|
|
|
|
gc-keep-outputs = true
|
|
|
|
'';
|
2019-11-07 14:25:27 +01:00
|
|
|
};
|
|
|
|
|
2019-11-06 23:04:16 +01:00
|
|
|
# Configure fish shell
|
2019-11-15 00:55:48 +01:00
|
|
|
programs.fish.enable = true;
|
2020-04-22 22:50:13 +02:00
|
|
|
users.users.root = {
|
2020-10-28 00:38:24 +01:00
|
|
|
shell = "${pkgs.fish}/bin/fish";
|
2020-05-11 06:36:55 +02:00
|
|
|
openssh.authorizedKeys.keys = [
|
|
|
|
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDL8fkFEI0+DnBJvSBSyLdOYweweaD9CUslL6cjZ3VgKh+B+SXBvNG4n3P94eHGS/lX00B66EufWCe/TtYG0mCPlhDIXnxV3TAA+aXlJEAZEwVyTqCuWgrsh0WolNBtdL/ji6ke85eeFxRP0p8WsTKNtjN5EIX+3iF6SkloO53l+hsT3sQkEXjIZ7svzQ/B+qb7+wJ35VD5InJUtiEHq29rydQF7QyBrn8Q2SF/NrtJmftjBFA6QL3STksxyW++LE8hv+2mn1LtRwY9UP8n+YaEp9R+mO3LwImvScQwvk7GbkEEbjaCanvw10h4vIB5uY8fahTkF3lUMk6O/4Poe3ar/myTvYpNEmvuKofqOMZ8uuPxhSWSjQLGvajh2JHoxVSZZwgXdG+1PBpWTO3sarVFU8GKdGHwcI5WIG63+axekyxH2NIt5H0X3HLc71TsYYcoFXeC3a19i2Y5vlsLEpbyqDWzwdE2qQFPCtTdHmUjwEEZb5Xyc9wK39doYZubu19/UoM81K5Zm1dapiAQ5SWTZjehpyd539IBXFph67Xah25QRfFEGk2xjGGNhTVQmIMUHrtkQhHDAZ1qND7XqCaUG/nOpi80MPQ0BaemDfOJyRcy3ExssO2hZ50coAShW2t+0yXNHUy0xbeBBGskQta44AcsKkAnkJL0fwBTTscREQ== coolneng@monolith"
|
|
|
|
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDFzv7R6htlqGXLWjscOxbj8nDOZLf6v61IUngSD2XvwzRGjiMhDPKxUEhkoBR5SbDAR0901Aakaf+SYxE9zpG29yncIGP9lLfs2iBBnH4ZXmsbaaEq7zhlpOHQnuT2rzwx5v1WiCZ2o57zuUm+4sd6j3pxqXGOPnVb0SaTLbIRuPR23l8zLLGdlyMF6k6iEjYQ6THuaRQBKQ7c9Cvy1dWUDdE+n7R/ESX9O1sjNVIc5zZIjsqTz4DEt6mIChNXGVHnQD+NKYpK8K+0yIYdKxoCLz0/HeMsHAM+bwl+np+ovk7tK4RKVUZ3f6d+nVm40vc2UW/UCrO4KPv3yrH4fVay5bvc0wQQwxfnSHJv3pVE0HFvZAMFQZst+6QUtttOZvF4IbhK5k/Vi3D0aMCGNa5DIAsq1wCOhR8e9oY0LAGkMyxnt0izJXNTGRXeM1EcHrxy9omU/pWaoiB7Eg0iWNgyg2UePpabknaIUo02dWdxmYV2OV/uORvClKSEvsym880= coolneng@panacea"
|
|
|
|
];
|
2020-04-22 22:50:13 +02:00
|
|
|
};
|
2019-11-06 23:04:16 +01:00
|
|
|
|
2020-02-23 14:59:06 +01:00
|
|
|
# Rotate logs after 7 days
|
|
|
|
services.journald.extraConfig = "SystemMaxFiles=7";
|
|
|
|
|
2020-08-20 15:03:45 +02:00
|
|
|
# Increase inotify limits
|
|
|
|
boot.kernel.sysctl = { "fs.inotify.max_user_watches" = 204800; };
|
|
|
|
|
2019-10-17 01:01:20 +02:00
|
|
|
# Import other configuration modules
|
2019-11-06 23:04:16 +01:00
|
|
|
imports = [
|
2020-09-06 00:39:40 +02:00
|
|
|
./modules/hardware-configuration.nix
|
2019-11-06 23:04:16 +01:00
|
|
|
./modules/networking.nix
|
2019-11-07 14:25:27 +01:00
|
|
|
./modules/datasync.nix
|
2019-11-10 23:40:31 +01:00
|
|
|
./modules/webstack.nix
|
2019-11-16 10:55:10 +01:00
|
|
|
./modules/devops.nix
|
2020-09-06 00:39:40 +02:00
|
|
|
./modules/monitoring.nix
|
2019-11-06 23:04:16 +01:00
|
|
|
];
|
2019-10-23 00:51:57 +02:00
|
|
|
|
2019-10-11 14:26:37 +02:00
|
|
|
}
|