nixos-config/config/nas.nix

182 lines
4.6 KiB
Nix
Raw Normal View History

2022-06-12 15:39:15 +00:00
{
config,
modulesPath,
lib,
nixos-hardware,
2023-06-07 04:48:37 +00:00
nixpkgs,
nix-packages,
2022-06-12 15:39:15 +00:00
...
} @ 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
2023-03-18 09:00:15 +00:00
nixos-hardware.nixosModules.common-pc-ssd
2022-04-24 20:20:17 +00:00
./services/hostapd.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
2023-04-08 08:33:48 +00:00
./services/woodpecker.nix
./services/woodpecker-agent.nix
2022-06-23 08:08:58 +00:00
./services/docker.nix
2023-01-14 13:57:00 +00:00
./users/remote-build.nix
2023-05-29 19:01:31 +00:00
./services/kubo-local.nix
2023-06-14 14:21:08 +00:00
./services/nfs.nix
2022-04-24 08:39:44 +00:00
];
hardware.cpu.amd.updateMicrocode = true;
2023-05-21 17:32:58 +00:00
boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "ahci" "usb_storage" "sd_mod" "bcache"];
2022-06-12 15:39:15 +00:00
boot.initrd.kernelModules = ["igb"];
boot.kernelModules = ["kvm-amd"];
2022-04-24 08:39:44 +00:00
boot.extraModulePackages = [
config.boot.kernelPackages.zenpower
];
2023-05-21 17:32:58 +00:00
services.btrfs.autoScrub = {
enable = true;
fileSystems = ["/"];
};
services.snapper.configs.main = {
2023-05-21 18:44:05 +00:00
SUBVOLUME = "/";
TIMELINE_LIMIT_HOURLY = "5";
TIMELINE_LIMIT_DAILY = "7";
TIMELINE_LIMIT_WEEKLY = "4";
TIMELINE_LIMIT_MONTHLY = "12";
TIMELINE_LIMIT_YEARLY = "0";
2023-05-21 17:32:58 +00:00
};
services.beesd.filesystems.root = {
2023-05-24 06:12:08 +00:00
spec = "/";
2023-05-21 17:32:58 +00:00
hashTableSizeMB = 2048;
verbosity = "crit";
2023-05-21 18:44:05 +00:00
extraOptions = ["--loadavg-target" "5.0"];
2023-05-21 17:32:58 +00:00
};
boot.supportedFilesystems = lib.mkForce ["btrfs" "vfat"];
2022-04-24 08:39:44 +00:00
fileSystems."/" = {
2023-05-21 17:32:58 +00:00
device = "/dev/bcache0";
fsType = "btrfs";
2022-04-24 08:39:44 +00:00
};
fileSystems."/boot" = {
2023-03-18 09:00:15 +00:00
device = "/dev/nvme0n1p1";
fsType = "vfat";
};
2022-04-24 08:39:44 +00:00
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 = {
2023-03-19 06:56:42 +00:00
br0.interfaces = ["enp9s0" "wlp7s0"];
};
2022-06-12 15:39:15 +00:00
networking.wireguard.interfaces."wg0".ips = ["fd0d:a262:1fa6:e621:bc9b:6a33:86e4:873b/64"];
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;
2023-06-03 14:38:27 +00:00
nix.settings.system-features = [
"kvm"
"nixos-test"
"big-parallel"
"benchmark"
"gccarch-znver1"
"gccarch-skylake"
"ca-derivations"
];
2022-04-24 08:39:44 +00:00
boot.binfmt.emulatedSystems = [
"armv7l-linux"
"powerpc-linux"
"powerpc64-linux"
"powerpc64le-linux"
"wasm32-wasi"
];
hardware.enableRedistributableFirmware = true;
nix.settings.substituters = lib.mkForce [
2023-03-10 15:21:26 +00:00
"https://attic.chir.rs/chir-rs/"
"https://cache.nixos.org/"
2023-03-05 20:51:07 +00:00
"https://beam.attic.rs/riscv"
"https://cache.ztier.in"
2022-04-24 08:39:44 +00:00
];
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-06-12 15:39:15 +00:00
home-manager.users.darkkirb = import ./home-manager/darkkirb.nix {
desktop = false;
inherit args;
};
2022-05-11 11:01:42 +00:00
networking.tc_cake = {
2023-03-18 09:02:19 +00:00
enp2s0f0u4 = {
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";
2023-03-18 09:02:19 +00:00
ifb = "ifb4enp2s0f0u4";
2022-05-11 11:01:42 +00:00
};
};
};
2022-11-06 09:51:36 +00:00
services.postgresql.settings = {
max_connections = 200;
shared_buffers = "4GB";
effective_cache_size = "12GB";
maintenance_work_mem = "1GB";
checkpoint_completion_target = 0.9;
wal_buffers = "16MB";
default_statistics_target = 100;
2023-03-18 09:21:03 +00:00
random_page_cost = 1.1;
effective_io_concurrency = 200;
2022-11-06 09:51:36 +00:00
work_mem = "5242kB";
min_wal_size = "1GB";
max_wal_size = "4GB";
max_worker_processes = 12;
max_parallel_workers_per_gather = 4;
max_parallel_workers = 12;
max_parallel_maintenance_workers = 4;
};
2023-02-01 20:01:01 +00:00
services.tailscale.useRoutingFeatures = "both";
2023-03-27 18:53:52 +00:00
hardware.sane.brscan4.enable = true;
2023-05-21 17:32:58 +00:00
system.autoUpgrade.allowReboot = true;
2023-05-29 19:01:31 +00:00
services.kubo.settings.Addresses.API = lib.mkForce [
"/ip4/0.0.0.0/tcp/5001"
"/ip6/::/tcp/5001"
]; # Only exposed over the tailed scale
2022-04-24 08:39:44 +00:00
}