nixos-config/hosts/monolith/default.nix

161 lines
4.4 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{
config,
lib,
pkgs,
modulesPath,
...
}:
let
btrfs_options = [
"compress=zstd:3"
"noatime"
"x-systemd.device-timeout=0"
];
in
{
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
./partition.nix
./amdgpu.nix
./factorio-server.nix
./nebula-vpn.nix
./minio.nix
./monolith-forgejo-runner.nix
./monolith-gitlab-runner.nix
];
boot.initrd.availableKernelModules = [
"nvme"
"xhci_pci"
"ahci"
"usb_storage"
"usbhid"
"sd_mod"
];
hardware.opentabletdriver = {
enable = true;
# TODO: remove this once otd gets updated
package = pkgs.unstable.opentabletdriver;
};
sops.defaultSopsFile = lib.mkForce ../../secrets/monolith/default.yaml;
my.gaming.enable = true;
my.nix-ld.enable = true;
systemd.slices."system" = {
enable = true;
sliceConfig = {
# 50% maximum usage accross 8 cores
CPUQuota = "${toString (8 * 50)}%";
};
};
boot.extraModulePackages = with config.boot.kernelPackages; [ zenpower ];
boot.initrd.kernelModules = [ "amdgpu" ];
boot.kernelModules = [
"kvm-amd"
"amdgpu"
"zenpower"
];
boot.kernelPackages = pkgs.linuxPackages_7_1;
systemd.sleep.settings.Sleep = {
HibernateDelaySec = "30s";
SuspendState = "mem";
};
# boot.initrd.luks.reusePassphrases = true;
boot.initrd.luks.devices = {
"data" = {
bypassWorkqueues = true;
device = "/dev/disk/by-label/CRYPT_DATA";
};
# "bigboy" = {
# bypassWorkqueues = true;
# device = "/dev/disk/by-label/CRYPT_BIGBOY";
# };
};
fileSystems."/home/lelgenio/Downloads/Torrents" = {
device = "/dev/disk/by-label/BTRFS_DATA";
fsType = "btrfs";
options = [
"subvol=@torrents"
"nofail"
]
++ btrfs_options;
};
fileSystems."/home/lelgenio/Música" = {
device = "/dev/disk/by-label/BTRFS_DATA";
fsType = "btrfs";
options = [
"subvol=@music"
"nofail"
]
++ btrfs_options;
};
fileSystems."/home/lelgenio/.local/mount/data" = {
device = "/dev/disk/by-label/BTRFS_DATA";
fsType = "btrfs";
options = [
"subvol=@data"
"nofail"
]
++ btrfs_options;
};
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp4s0.useDHCP = lib.mkDefault true;
powerManagement.cpuFreqGovernor = "ondemand";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
networking.hostName = "monolith"; # Define your hostname.
virtualisation.virtualbox.host.enable = true;
services.udev.extraRules = ''
# Arm all USB root hubs (vendor 1d6b) so any USB device can wake the system.
# Wakeup only fires if the device on the end also has wakeup enabled, so we still
# disable it individually for devices that must NOT wake the system (see below).
ACTION=="add" SUBSYSTEM=="usb" ATTR{idVendor}=="1d6b" ATTR{power/wakeup}="enabled"
# Fix broken suspend with Logitech USB dongle
# The mouse/mousepad receiver wakes the system right after suspend, so disable its wakeup.
# `lsusb | grep Logitech` will return "vendor:product"
ACTION=="add" SUBSYSTEM=="usb" ATTR{idVendor}=="046d" ATTR{idProduct}=="c53a" ATTR{power/wakeup}="disabled"
# Force all disks to use kyber scheduler
# For some reason "noop" is used by default which is kinda bad when io is saturated
ACTION=="add|change", KERNEL=="sd[a-z]*[0-9]*|mmcblk[0-9]*p[0-9]*|nvme[0-9]*n[0-9]*p[0-9]*", ATTR{../queue/scheduler}="kyber"
'';
boot.tmp = {
cleanOnBoot = true;
useTmpfs = true;
};
fileSystems."/nix/var/nix/builds" = {
device = "tmpfs";
fsType = "tmpfs";
options = [
"size=20G" # adjust for your situation and needs
"mode=700"
];
};
zramSwap.enable = true;
zramSwap.memoryPercent = 100;
boot.kernel.sysctl = {
"vm.swappiness" = 180;
"vm.watermark_boost_factor" = 0;
"vm.watermark_scale_factor" = 125;
"vm.page-cluster" = 0;
};
}