nixos-config/config/thinkrac.nix

123 lines
3.6 KiB
Nix
Raw Normal View History

2022-06-12 15:39:15 +00:00
{
modulesPath,
nixos-hardware,
2023-08-13 19:18:22 +00:00
config,
2023-11-29 14:46:46 +00:00
lib,
pkgs,
2022-06-12 15:39:15 +00:00
...
}: {
2022-01-29 14:50:06 +00:00
networking.hostName = "thinkrac";
networking.hostId = "2bfaea87";
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
./systemd-boot.nix
./desktop.nix
2022-04-20 12:40:09 +00:00
./services/tpm2.nix
nixos-hardware.nixosModules.lenovo-thinkpad-t470s
#nixos-hardware.nixosModules.common-cpu-intel-kaby-lake
nixos-hardware.nixosModules.common-pc-ssd
2022-12-16 07:26:04 +00:00
./services/postgres.nix
2022-01-29 14:50:06 +00:00
];
hardware.cpu.intel.updateMicrocode = true;
2022-06-12 15:39:15 +00:00
boot.initrd.availableKernelModules = ["xhci_pci" "nvme" "usb_storage" "sd_mod" "bcache"];
boot.initrd.kernelModules = [];
boot.kernelModules = ["kvm-intel"];
boot.extraModulePackages = [];
2023-11-29 18:08:26 +00:00
2022-03-24 08:33:29 +00:00
fileSystems."/" = {
2023-11-29 14:46:46 +00:00
device = "/dev/nvme0n1p2";
fsType = "btrfs";
options = ["compress=zstd"];
2022-04-13 06:29:08 +00:00
};
2023-11-29 18:08:26 +00:00
2023-11-29 14:46:46 +00:00
fileSystems."/boot" = {
device = "/dev/nvme0n1p1";
fsType = "vfat";
2022-04-13 06:29:08 +00:00
};
2023-11-29 14:46:46 +00:00
services.btrfs.autoScrub = {
enable = true;
fileSystems = ["/"];
2022-04-13 06:29:08 +00:00
};
2023-11-29 14:46:46 +00:00
services.snapper.configs.main = {
SUBVOLUME = "/";
2024-07-05 14:26:31 +00:00
TIMELINE_LIMIT_HOURLY = 5;
TIMELINE_LIMIT_DAILY = 7;
TIMELINE_LIMIT_WEEKLY = 4;
TIMELINE_LIMIT_MONTHLY = 12;
TIMELINE_LIMIT_YEARLY = 0;
2022-04-13 06:29:08 +00:00
};
2024-09-08 06:38:56 +00:00
services.beesd.filesystems.root = {
2023-11-29 14:46:46 +00:00
spec = "/";
hashTableSizeMB = 2048;
verbosity = "crit";
extraOptions = ["--loadavg-target" "5.0"];
2022-04-13 06:29:08 +00:00
};
2022-01-29 14:50:06 +00:00
2023-11-29 18:08:26 +00:00
swapDevices = [
{
device = "/dev/nvme0n1p3";
}
];
2022-01-29 14:50:06 +00:00
networking.interfaces.enp0s31f6.useDHCP = true;
2023-11-29 14:46:46 +00:00
system.stateVersion = "23.11";
2022-06-12 15:39:15 +00:00
services.xserver.videoDrivers = ["modesetting"];
nix.settings.cores = 4;
# use the lowest frequency possible, to save power
powerManagement.cpuFreqGovernor = "powersave";
# lm_sensors who cares
environment.etc."sysconfig/lm_sensors".text = ''
# Generated by sensors-detect on Tue Aug 7 10:54:09 2018
# 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="coretemp"
'';
services.thermald.enable = true;
boot.extraModprobeConfig = ''
# enable power savings mode of snd_hda_intel
options snd-hda-intel power_save=1 power_save_controller=y
# enable power savings mode of igpu, enable framebuffer compression, downclock the LVDS connection
options i915 i915_enable_rc6=7 i915_enable_fbc=1 lvds_downclock=1
# automatically suspend USB devices
options usbcore autosuspend=2
# Fan control for thinkpads
options thinkpad_acpi fan_control=1
2023-09-24 12:33:14 +00:00
options zfs zfs_arc_max=4294967296
'';
boot.kernel.sysctl = {
# Probably unnecessary
"kernel.nmi_watchdog" = "0";
"vm.laptop_mode" = "5";
# The kernel flusher threads will periodically wake up and write `old' data out to disk. This
# tunable expresses the interval between those wakeups, in 100'ths of a second (Default is 500).
"vm.dirty_writeback_centisecs" = "1500";
};
2022-02-15 21:04:53 +00:00
networking.networkmanager.enable = true;
2022-06-12 15:39:15 +00:00
users.users.darkkirb.extraGroups = ["networkmanager"];
nix.settings.max-jobs = 4;
nix.daemonCPUSchedPolicy = "idle";
nix.daemonIOSchedClass = "idle";
nix.settings.system-features = [
"kvm"
"nixos-test"
"big-parallel"
"benchmark"
"gccarch-skylake"
"ca-derivations"
];
2022-12-11 17:01:26 +00:00
services.joycond.enable = true;
hardware.bluetooth.enable = true;
services.blueman.enable = true;
2023-02-01 20:01:01 +00:00
services.tailscale.useRoutingFeatures = "client";
2023-12-10 09:36:28 +00:00
services.prometheus.exporters.node.enabledCollectors = ["wifi"];
2022-01-29 14:50:06 +00:00
}