zion/configuration.nix

114 lines
3.7 KiB
Nix
Raw Normal View History

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;
2020-05-11 06:36:55 +02:00
2020-12-22 14:49:13 +01:00
# A bunch of boot parameters needed for optimal runtime on RPi 4B
boot.kernelPackages = pkgs.linuxPackages_rpi4;
boot.kernelParams =
[ "zfs.zfs_arc_max=134217728" "console=TTYAMA0,115200" "console=tty1" ];
boot.loader.raspberryPi = {
enable = true;
2020-12-22 14:49:13 +01:00
version = 4;
2020-05-09 00:22:43 +02:00
};
environment.systemPackages = with pkgs; [ libraspberrypi 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";
2020-12-22 14:49:13 +01:00
size = 4096;
2020-05-11 06:36:55 +02:00
}];
2019-10-11 19:14:18 +02:00
# Configure basic SSH access
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
# Create coolneng user
2019-10-16 22:17:37 +02:00
users.users.coolneng = {
isNormalUser = true;
home = "/home/coolneng";
extraGroups = [ "wheel" "docker" ];
2020-05-11 06:36:55 +02:00
openssh.authorizedKeys.keys = [
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDFzv7R6htlqGXLWjscOxbj8nDOZLf6v61IUngSD2XvwzRGjiMhDPKxUEhkoBR5SbDAR0901Aakaf+SYxE9zpG29yncIGP9lLfs2iBBnH4ZXmsbaaEq7zhlpOHQnuT2rzwx5v1WiCZ2o57zuUm+4sd6j3pxqXGOPnVb0SaTLbIRuPR23l8zLLGdlyMF6k6iEjYQ6THuaRQBKQ7c9Cvy1dWUDdE+n7R/ESX9O1sjNVIc5zZIjsqTz4DEt6mIChNXGVHnQD+NKYpK8K+0yIYdKxoCLz0/HeMsHAM+bwl+np+ovk7tK4RKVUZ3f6d+nVm40vc2UW/UCrO4KPv3yrH4fVay5bvc0wQQwxfnSHJv3pVE0HFvZAMFQZst+6QUtttOZvF4IbhK5k/Vi3D0aMCGNa5DIAsq1wCOhR8e9oY0LAGkMyxnt0izJXNTGRXeM1EcHrxy9omU/pWaoiB7Eg0iWNgyg2UePpabknaIUo02dWdxmYV2OV/uORvClKSEvsym880= coolneng@panacea"
];
shell = "${pkgs.fish}/bin/fish";
2019-10-16 22:17:37 +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;
# Enable ZFS support
2020-12-28 18:42:46 +01:00
networking.hostId = "4e74ea68";
boot = {
supportedFilesystems = [ "zfs" ];
zfs.extraPools = [ "vault" ];
};
2019-10-18 00:31:34 +02:00
# Scrub zpool monthly
services.zfs.autoScrub = {
enable = true;
interval = "monthly";
};
2019-10-18 00:31:34 +02:00
# Auto-upgrade the system and reboot if needed
system.autoUpgrade = {
enable = true;
Package cleanup and reverse proxy service restart Squashed commit of the following: commit db95d142d42f97891db9aecd61625886c84e18a4 Author: coolneng <akasroua@gmail.com> Date: Thu Jan 30 13:23:23 2020 +0100 Update Syncthing IDs and add roamer to Wireguard commit 6a2346d4a1b6bf39e57130bf2a70e5e190850fc9 Author: coolneng <akasroua@gmail.com> Date: Wed Jan 29 14:30:31 2020 +0100 Add wireguard server configuration commit 09c5755ec8119db3f17df180034ea5c03adc5242 Author: coolneng <akasroua@gmail.com> Date: Wed Jan 29 00:20:52 2020 +0100 Add wireguard packages commit c542b06c9d718da9ca5ec6b00bf5179e970ccbdb Author: coolneng <akasroua@gmail.com> Date: Tue Jan 28 21:57:53 2020 +0100 Move zeroconf section to networking commit 1af6e07072ba345482b71b1817563c6a8c01f71c Author: coolneng <akasroua@gmail.com> Date: Tue Jan 28 21:54:39 2020 +0100 Revert "Clean up packages and refactor nginx config" This reverts commit 375758a958c4dd9f1ba99d25fc6840c52a5582a7. commit 5eb5e446ade2854e966ba0f60067e3b153a7a119 Author: coolneng <akasroua@gmail.com> Date: Sun Jan 26 19:39:28 2020 +0100 Add wallabag docker container commit 375758a958c4dd9f1ba99d25fc6840c52a5582a7 Author: coolneng <akasroua@gmail.com> Date: Sun Jan 26 08:45:56 2020 +0100 Clean up packages and refactor nginx config commit f210353ce53d378eb01f7124c889df156758470a Author: coolneng <akasroua@gmail.com> Date: Tue Dec 31 18:41:34 2019 +0100 Delete Security folder from Syncthing commit 65afa32e57032eb59444fecb223d69dbfef585bd Author: coolneng <akasroua@gmail.com> Date: Thu Dec 26 04:19:38 2019 +0100 Use 'after' instead of 'wantedBy' commit 8cc829e06329a0eb75b3d924c9843370e41c9555 Author: coolneng <akasroua@gmail.com> Date: Thu Dec 26 04:16:21 2019 +0100 Use wantedBy instead of partOf commit e490102d74fada01a336d42086c186c06ab4ff8b Merge: 91d4b24 51ed142 Author: coolneng <akasroua@gmail.com> Date: Wed Dec 25 17:47:14 2019 +0100 Merge branch 'test' of gitea into test commit 51ed142c5f851a718ec814a8badc0ca670f22d7b Author: coolneng <akasroua@gmail.com> Date: Wed Dec 25 17:15:42 2019 +0100 Use mkforce for 'partOf' option commit caf4a49ec2796948213539f0dcb6a38d51228f6f Author: coolneng <akasroua@gmail.com> Date: Wed Dec 25 16:37:11 2019 +0100 Configure nginx service as dependent on gitea commit e8850eff5166ae6f6e56ac11d58cc56491fca255 Author: coolneng <akasroua@gmail.com> Date: Wed Dec 25 16:24:10 2019 +0100 Restart nginx after Gitea commit 91d4b240d7b188b973ec7c3a86138587c52920fe Author: coolneng <akasroua@gmail.com> Date: Sun Dec 15 22:54:00 2019 +0100 # This is a combination of 2 commits. # This is the 1st commit message: Revert "Disable wizard on Gitea" This reverts commit d8b415ee16e1a560dac430f577d34cb098e0f832. # This is the commit message #2: Remove Gitea socket connection to the DB
2020-02-21 12:24:13 +01:00
allowReboot = true;
2019-10-23 00:51:57 +02:00
};
2021-01-01 16:52:31 +01:00
# Run Nix garbage collector, while avoiding recompilation
nix = {
2021-01-01 16:52:31 +01:00
autoOptimiseStore = true;
gc = {
automatic = true;
options = "--delete-older-than 14d";
};
extraOptions = ''
keep-outputs = true
2021-01-01 16:52:31 +01:00
keep-derivations = 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 = {
shell = "${pkgs.fish}/bin/fish";
2020-05-11 06:36:55 +02:00
openssh.authorizedKeys.keys = [
"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; };
# 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
2020-11-30 02:03:58 +01:00
./modules/periodic.nix
2020-12-28 18:42:26 +01:00
./modules/communication.nix
2021-01-19 00:14:57 +01:00
./modules/information.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
}