nixos-config/config/nas.nix

289 lines
7.4 KiB
Nix
Raw Normal View History

2022-06-12 15:39:15 +00:00
{
config,
pkgs,
modulesPath,
lib,
nixos-hardware,
...
} @ args: {
2022-04-24 08:39:44 +00:00
networking.hostName = "nas";
networking.hostId = "70af00ed";
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
./systemd-boot.nix
./services/tpm2.nix
./server.nix
2022-04-24 08:54:25 +00:00
./services/hydra.nix
2022-04-24 12:11:41 +00:00
./services/backup.nix
2022-04-24 08:39:44 +00:00
nixos-hardware.nixosModules.common-cpu-amd
nixos-hardware.nixosModules.common-pc-hdd
2022-04-24 20:20:17 +00:00
./services/hostapd.nix
2022-04-25 16:47:49 +00:00
./services/mastodon.nix
2022-04-29 12:46:55 +00:00
./services/rspamd.nix
2022-05-01 06:50:10 +00:00
./services/synapse.nix
2022-07-22 10:54:03 +00:00
./services/mautrix-discord.nix
2022-04-30 19:57:51 +00:00
./services/mautrix-telegram.nix
2022-05-03 19:25:44 +00:00
./services/mautrix-whatsapp.nix
2022-05-03 20:36:55 +00:00
./services/mautrix-signal.nix
2022-05-05 19:58:29 +00:00
./services/router.nix
2022-05-06 09:54:54 +00:00
./services/syncthing.nix
2022-05-13 07:46:25 +00:00
../modules/tc-cake.nix
2022-05-25 08:36:03 +00:00
./services/cups.nix
2022-06-20 18:15:47 +00:00
./services/iscsi.nix
2022-06-21 12:47:27 +00:00
./services/samba.nix
2022-06-23 06:35:05 +00:00
./services/drone.nix
2022-06-23 10:41:43 +00:00
./services/drone-runner-docker.nix
2022-06-23 08:08:58 +00:00
./services/docker.nix
2022-04-24 08:39:44 +00:00
];
hardware.cpu.amd.updateMicrocode = true;
2022-06-12 15:39:15 +00:00
boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "usb_storage" "sd_mod"];
boot.initrd.kernelModules = ["igb"];
boot.kernelModules = ["kvm-amd"];
2022-04-24 08:39:44 +00:00
boot.extraModulePackages = [
config.boot.kernelPackages.zenpower
];
2022-06-12 15:39:15 +00:00
boot.supportedFilesystems = ["zfs"];
2022-04-24 08:39:44 +00:00
boot.zfs.devNodes = "/dev/";
services.zfs.autoScrub.enable = true;
2022-06-12 15:39:15 +00:00
services.zfs.autoScrub.pools = ["tank"];
2022-04-24 08:39:44 +00:00
boot.initrd.luks.devices = {
disk0.device = "/dev/disk/by-partuuid/b122f4e7-9edf-402e-87a9-b709741fe8c9";
disk1.device = "/dev/disk/by-partuuid/6e080c43-35fc-4c7c-a749-112d5b618a64";
disk2.device = "/dev/disk/by-partuuid/13f012a4-b9a9-4144-8888-cbb637657f69";
};
fileSystems."/" = {
device = "tank/nixos";
fsType = "zfs";
2022-06-12 15:39:15 +00:00
options = ["zfsutil"];
2022-04-24 08:39:44 +00:00
};
fileSystems."/nix" = {
device = "tank/nixos/nix";
fsType = "zfs";
2022-06-12 15:39:15 +00:00
options = ["zfsutil"];
2022-04-24 08:39:44 +00:00
};
fileSystems."/etc" = {
device = "tank/nixos/etc";
fsType = "zfs";
2022-06-12 15:39:15 +00:00
options = ["zfsutil"];
2022-04-24 08:39:44 +00:00
};
fileSystems."/var" = {
device = "tank/nixos/var";
fsType = "zfs";
2022-06-12 15:39:15 +00:00
options = ["zfsutil"];
2022-04-24 08:39:44 +00:00
};
fileSystems."/var/lib" = {
device = "tank/nixos/var/lib";
fsType = "zfs";
2022-06-12 15:39:15 +00:00
options = ["zfsutil"];
2022-04-24 08:39:44 +00:00
};
2022-05-06 09:54:54 +00:00
fileSystems."/var/lib/syncthing" = {
device = "tank/nixos/var/lib/syncthing";
fsType = "zfs";
2022-06-12 15:39:15 +00:00
options = ["zfsutil"];
2022-05-06 09:54:54 +00:00
};
fileSystems."/var/lib/syncthing/.wine" = {
device = "tank/nixos/var/lib/syncthing/.wine";
fsType = "zfs";
2022-06-12 15:39:15 +00:00
options = ["zfsutil"];
2022-05-06 09:54:54 +00:00
};
fileSystems."/var/lib/syncthing/lennyface" = {
device = "tank/nixos/var/lib/syncthing/lennyface";
fsType = "zfs";
2022-06-12 15:39:15 +00:00
options = ["zfsutil"];
2022-05-06 09:54:54 +00:00
};
fileSystems."/var/lib/syncthing/Music-flac" = {
device = "tank/nixos/var/lib/syncthing/Music-flac";
fsType = "zfs";
2022-06-12 15:39:15 +00:00
options = ["zfsutil"];
2022-05-06 09:54:54 +00:00
};
fileSystems."/var/lib/syncthing/Studium" = {
device = "tank/nixos/var/lib/syncthing/Studium";
fsType = "zfs";
2022-06-12 15:39:15 +00:00
options = ["zfsutil"];
2022-05-06 09:54:54 +00:00
};
fileSystems."/var/lib/syncthing/Pictures" = {
device = "tank/nixos/var/lib/syncthing/Pictures";
fsType = "zfs";
2022-06-12 15:39:15 +00:00
options = ["zfsutil"];
2022-05-06 09:54:54 +00:00
};
fileSystems."/var/lib/syncthing/Data" = {
device = "tank/nixos/var/lib/syncthing/Data";
fsType = "zfs";
2022-06-12 15:39:15 +00:00
options = ["zfsutil"];
2022-05-06 09:54:54 +00:00
};
fileSystems."/var/lib/syncthing/CarolineFlac" = {
device = "tank/nixos/var/lib/syncthing/CarolineFlac";
fsType = "zfs";
2022-06-12 15:39:15 +00:00
options = ["zfsutil"];
2022-05-06 09:54:54 +00:00
};
fileSystems."/var/lib/syncthing/Camera" = {
device = "tank/nixos/var/lib/syncthing/Camera";
fsType = "zfs";
2022-06-12 15:39:15 +00:00
options = ["zfsutil"];
2022-05-06 09:54:54 +00:00
};
fileSystems."/var/lib/syncthing/reveng" = {
device = "tank/nixos/var/lib/syncthing/reveng";
fsType = "zfs";
2022-06-12 15:39:15 +00:00
options = ["zfsutil"];
2022-05-06 09:54:54 +00:00
};
fileSystems."/var/lib/syncthing/Music" = {
device = "tank/nixos/var/lib/syncthing/Music";
fsType = "zfs";
2022-06-12 15:39:15 +00:00
options = ["zfsutil"];
2022-05-06 09:54:54 +00:00
};
fileSystems."/var/lib/syncthing/Documents" = {
device = "tank/nixos/var/lib/syncthing/Documents";
fsType = "zfs";
2022-06-12 15:39:15 +00:00
options = ["zfsutil"];
2022-05-06 09:54:54 +00:00
};
2022-04-24 08:39:44 +00:00
fileSystems."/var/log" = {
device = "tank/nixos/var/log";
fsType = "zfs";
2022-06-12 15:39:15 +00:00
options = ["zfsutil"];
2022-04-24 08:39:44 +00:00
};
fileSystems."/var/spool" = {
device = "tank/nixos/var/spool";
fsType = "zfs";
2022-06-12 15:39:15 +00:00
options = ["zfsutil"];
2022-04-24 08:39:44 +00:00
};
fileSystems."/home" = {
device = "tank/userdata/home";
fsType = "zfs";
2022-06-12 15:39:15 +00:00
options = ["zfsutil"];
2022-04-24 08:39:44 +00:00
};
fileSystems."/root" = {
device = "tank/userdata/home/root";
fsType = "zfs";
2022-06-12 15:39:15 +00:00
options = ["zfsutil"];
2022-04-24 08:39:44 +00:00
};
fileSystems."/home/darkkirb" = {
device = "tank/userdata/home/darkkirb";
fsType = "zfs";
2022-06-12 15:39:15 +00:00
options = ["zfsutil"];
2022-04-24 08:39:44 +00:00
};
fileSystems."/boot" = {
2022-04-24 10:20:00 +00:00
device = "/dev/disk/by-partuuid/b50f9cff-552d-4c6e-bda2-104723ee638e";
fsType = "vfat";
};
fileSystems."/boot2" = {
device = "/dev/disk/by-partuuid/6f365c6a-63a2-4fb9-976b-ec9e04c9cb13";
fsType = "vfat";
};
fileSystems."/boot3" = {
device = "/dev/disk/by-partuuid/324146ea-edb6-4f2e-b260-af8eddfb1eca";
2022-04-24 08:39:44 +00:00
fsType = "vfat";
};
swapDevices = [
{
device = "/dev/disk/by-partuuid/3b652a7e-a550-4342-a0d7-d2ae47b3e9d1";
randomEncryption = true;
}
{
device = "/dev/disk/by-partuuid/59de36d4-6613-4b50-9643-8824e9a9b1f9";
randomEncryption = true;
}
{
device = "/dev/disk/by-partuuid/f6260d75-2b96-4f55-ba0f-050c58b84b78";
randomEncryption = true;
}
];
2022-04-24 21:13:59 +00:00
networking.interfaces.br0 = {
2022-04-24 08:39:44 +00:00
ipv4 = {
addresses = [
{
2022-05-05 19:58:29 +00:00
address = "192.168.2.1";
2022-04-24 08:39:44 +00:00
prefixLength = 24;
}
];
};
};
networking.bridges = {
2022-06-12 15:39:15 +00:00
br0.interfaces = ["enp8s0" "wlp6s0"];
};
2022-06-12 15:39:15 +00:00
networking.wireguard.interfaces."wg0".ips = ["fd0d:a262:1fa6:e621:bc9b:6a33:86e4:873b/64"];
networking.nameservers = ["192.168.2.1"];
2022-04-24 08:39:44 +00:00
environment.etc."sysconfig/lm_sensors".text = ''
# Generated by sensors-detect on Sun Apr 24 08:31:51 2022
# This file is sourced by /etc/init.d/lm_sensors and defines the modules to
# be loaded/unloaded.
#
# The format of this file is a shell script that simply defines variables:
# HWMON_MODULES for hardware monitoring driver modules, and optionally
# BUS_MODULES for any required bus driver module (for example for I2C or SPI).
HWMON_MODULES="it87"
'';
nix.settings.cores = 12;
boot.binfmt.emulatedSystems = [
"armv7l-linux"
"aarch64-linux"
"powerpc-linux"
"powerpc64-linux"
"powerpc64le-linux"
"riscv32-linux"
"riscv64-linux"
"wasm32-wasi"
];
hardware.enableRedistributableFirmware = true;
nix.settings.substituters = lib.mkForce [
"https://cache.nixos.org/"
];
nix.daemonCPUSchedPolicy = "idle";
nix.daemonIOSchedClass = "idle";
networking.wireguard.interfaces.wg0.peers = [
# nutty-noon
{
publicKey = "YYQmSJwipRkZJUsPV5DxhfyRBMdj/O1XzN+cGYtUi1s=";
allowedIPs = [
"fd0d:a262:1fa6:e621:47e6:24d4:2acb:9437/128"
];
}
];
2022-05-28 19:53:40 +00:00
system.stateVersion = "22.05";
2022-04-24 08:45:48 +00:00
hardware.nvidia.prime.offload.enable = false;
2022-06-12 15:39:15 +00:00
services.xserver.videoDrivers = ["nvidia"];
home-manager.users.darkkirb = import ./home-manager/darkkirb.nix {
desktop = false;
inherit args;
};
2022-05-11 11:01:42 +00:00
networking.tc_cake = {
enp1s0f0u4 = {
2022-05-13 09:27:06 +00:00
disableOffload = true;
2022-05-11 11:01:42 +00:00
shapeEgress = {
bandwidth = "4mbit";
extraArgs = "docsis nat ack-filter";
};
shapeIngress = {
bandwidth = "33mbit";
ifb = "ifb4enp1s0f0u4";
};
};
};
2022-06-23 08:08:58 +00:00
virtualisation.docker.daemon.settings = {
storage-opts = [
"zfs.fsname=tank/docker"
];
};
2022-04-24 08:39:44 +00:00
}