nixos-config/config/nas.nix

214 lines
5 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,
2024-05-23 13:06:26 +00:00
pkgs,
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 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-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 08:08:58 +00:00
./services/docker.nix
2023-01-14 13:57:00 +00:00
./users/remote-build.nix
2023-06-14 14:21:08 +00:00
./services/nfs.nix
2023-12-10 10:27:30 +00:00
./services/tempo.nix
2023-12-10 20:08:38 +00:00
./services/loki.nix
2023-12-10 20:27:33 +00:00
./services/prometheus.nix
2024-03-19 09:07:25 +00:00
./services/yiff-stash.nix
2024-03-23 13:01:46 +00:00
./services/reverse-proxy.nix
2024-04-08 20:05:37 +00:00
./services/jellyfin.nix
2024-04-13 11:31:08 +00:00
../new-infra/devices/nas.nix
2024-05-03 04:13:03 +00:00
./services/mautrix-discord.nix
./services/mautrix-telegram.nix
./services/mautrix-whatsapp.nix
2024-05-16 13:42:44 +00:00
./services/mautrix-signal.nix
2024-05-03 04:13:03 +00:00
./services/synapse.nix
./services/heisenbridge.nix
2024-06-01 08:21:59 +00:00
#./services/kubernetes.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
];
2024-04-25 05:39:15 +00:00
boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
2022-04-24 08:39:44 +00:00
fileSystems."/" = {
2024-04-25 05:39:15 +00:00
device = "tank/system/root";
fsType = "zfs";
};
fileSystems."/etc" = {
device = "tank/system/etc";
fsType = "zfs";
};
fileSystems."/nix" = {
device = "tank/system/nix";
fsType = "zfs";
};
fileSystems."/var" = {
device = "tank/data/var";
fsType = "zfs";
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
2024-04-25 05:39:15 +00:00
services.sanoid = {
enable = true;
datasets."tank/data" = {
yearly = 1;
recursive = true;
monthly = 12;
hourly = 24;
daily = 30;
autosnap = true;
autoprune = true;
};
};
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"
2023-10-19 08:02:43 +00:00
"riscv32-linux"
"riscv64-linux"
2022-04-24 08:39:44 +00:00
];
hardware.enableRedistributableFirmware = true;
nix.settings.substituters = lib.mkForce [
"https://attic.chir.rs/chir-rs/"
"https://cache.nixos.org/"
2022-04-24 08:39:44 +00:00
];
nix.daemonCPUSchedPolicy = "idle";
nix.daemonIOSchedClass = "idle";
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-10-11 18:10:17 +00:00
swapDevices = [
{
device = "/dev/sda2";
}
{
device = "/dev/sdb2";
}
{
device = "/dev/sdc2";
}
];
2024-04-08 20:05:37 +00:00
hardware.opengl = {
enable = true;
driSupport32Bit = true;
};
services.xserver.videoDrivers = ["nvidia"];
hardware.nvidia = {
modesetting.enable = true;
powerManagement.enable = false;
powerManagement.finegrained = false;
open = false;
nvidiaSettings = true;
package = config.boot.kernelPackages.nvidiaPackages.stable;
};
2024-05-06 08:58:52 +00:00
services.restic.backups.sysbackup = {
paths = ["/persist"];
pruneOpts = [
"--keep-daily 7"
"--keep-weekly 4"
"--keep-monthly 12"
"--keep-yearly 10"
];
};
system.autoUpgrade.allowReboot = true;
2024-05-23 13:06:26 +00:00
virtualisation.docker = {
enable = true;
2024-06-11 09:07:47 +00:00
#enableNvidia = true;
2024-05-23 13:06:26 +00:00
};
environment.systemPackages = with pkgs; [docker runc];
2022-04-24 08:39:44 +00:00
}