2022-06-12 15:39:15 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
modulesPath,
|
|
|
|
lib,
|
|
|
|
nixos-hardware,
|
|
|
|
system,
|
|
|
|
...
|
|
|
|
}: {
|
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
|
2022-03-22 18:22:35 +00:00
|
|
|
nixos-hardware.nixosModules.lenovo-thinkpad-t470s
|
|
|
|
nixos-hardware.nixosModules.common-cpu-intel-kaby-lake
|
|
|
|
nixos-hardware.nixosModules.common-pc-ssd
|
2022-06-03 15:34:16 +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 = [];
|
2022-05-02 08:26:56 +00:00
|
|
|
boot.zfs.enableUnstable = true;
|
2022-01-29 14:50:06 +00:00
|
|
|
|
2022-06-12 15:39:15 +00:00
|
|
|
boot.supportedFilesystems = ["zfs"];
|
2022-04-13 06:29:08 +00:00
|
|
|
boot.zfs.devNodes = "/dev/";
|
|
|
|
|
|
|
|
services.zfs.trim.enable = true;
|
|
|
|
services.zfs.autoScrub.enable = true;
|
2022-06-12 15:39:15 +00:00
|
|
|
services.zfs.autoScrub.pools = ["tank"];
|
2022-01-29 14:50:06 +00:00
|
|
|
|
|
|
|
boot.initrd.luks.devices = {
|
|
|
|
disk = {
|
2022-03-24 08:33:29 +00:00
|
|
|
device = "/dev/disk/by-uuid/2100a2e1-d874-4aaa-a89f-0b01665445b4";
|
2022-01-29 14:50:06 +00:00
|
|
|
allowDiscards = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-03-24 08:33:29 +00:00
|
|
|
fileSystems."/" = {
|
2022-04-13 06:29:08 +00:00
|
|
|
device = "tank/nixos";
|
|
|
|
fsType = "zfs";
|
2022-06-12 15:39:15 +00:00
|
|
|
options = ["zfsutil"];
|
2022-04-13 06:29:08 +00:00
|
|
|
};
|
2022-01-29 14:50:06 +00:00
|
|
|
|
2022-04-13 06:29:08 +00:00
|
|
|
fileSystems."/nix" = {
|
|
|
|
device = "tank/nixos/nix";
|
|
|
|
fsType = "zfs";
|
2022-06-12 15:39:15 +00:00
|
|
|
options = ["zfsutil"];
|
2022-04-13 06:29:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
fileSystems."/etc" = {
|
|
|
|
device = "tank/nixos/etc";
|
|
|
|
fsType = "zfs";
|
2022-06-12 15:39:15 +00:00
|
|
|
options = ["zfsutil"];
|
2022-04-13 06:29:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
fileSystems."/var" = {
|
|
|
|
device = "tank/nixos/var";
|
|
|
|
fsType = "zfs";
|
2022-06-12 15:39:15 +00:00
|
|
|
options = ["zfsutil"];
|
2022-04-13 06:29:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
fileSystems."/var/lib" = {
|
|
|
|
device = "tank/nixos/var/lib";
|
|
|
|
fsType = "zfs";
|
2022-06-12 15:39:15 +00:00
|
|
|
options = ["zfsutil"];
|
2022-04-13 06:29:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
fileSystems."/var/log" = {
|
|
|
|
device = "tank/nixos/var/log";
|
|
|
|
fsType = "zfs";
|
2022-06-12 15:39:15 +00:00
|
|
|
options = ["zfsutil"];
|
2022-04-13 06:29:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
fileSystems."/var/spool" = {
|
|
|
|
device = "tank/nixos/var/spool";
|
|
|
|
fsType = "zfs";
|
2022-06-12 15:39:15 +00:00
|
|
|
options = ["zfsutil"];
|
2022-04-13 06:29:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
fileSystems."/home" = {
|
|
|
|
device = "tank/userdata/home";
|
|
|
|
fsType = "zfs";
|
2022-06-12 15:39:15 +00:00
|
|
|
options = ["zfsutil"];
|
2022-04-13 06:29:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
fileSystems."/root" = {
|
2022-04-16 09:29:49 +00:00
|
|
|
device = "tank/userdata/home/root";
|
2022-04-13 06:29:08 +00:00
|
|
|
fsType = "zfs";
|
2022-06-12 15:39:15 +00:00
|
|
|
options = ["zfsutil"];
|
2022-04-13 06:29:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
fileSystems."/home/darkkirb" = {
|
|
|
|
device = "tank/userdata/home/darkkirb";
|
|
|
|
fsType = "zfs";
|
2022-06-12 15:39:15 +00:00
|
|
|
options = ["zfsutil"];
|
2022-04-13 06:29:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
fileSystems."/build" = {
|
|
|
|
device = "tank/build";
|
|
|
|
fsType = "zfs";
|
2022-06-12 15:39:15 +00:00
|
|
|
options = ["zfsutil"];
|
2022-04-13 06:29:08 +00:00
|
|
|
};
|
2022-01-29 14:50:06 +00:00
|
|
|
|
2022-03-24 08:33:29 +00:00
|
|
|
fileSystems."/boot" = {
|
2022-04-13 06:29:08 +00:00
|
|
|
device = "/dev/disk/by-uuid/EE61-E55F";
|
|
|
|
fsType = "vfat";
|
|
|
|
};
|
2022-01-29 14:50:06 +00:00
|
|
|
|
|
|
|
networking.interfaces.enp0s31f6.useDHCP = true;
|
2022-05-28 19:53:40 +00:00
|
|
|
system.stateVersion = "22.05";
|
2022-01-29 14:50:06 +00:00
|
|
|
networking.wireguard.interfaces."wg0".ips = [
|
|
|
|
"fd0d:a262:1fa6:e621:f45a:db9f:eb7c:1a3f/64"
|
|
|
|
];
|
2022-06-12 15:39:15 +00:00
|
|
|
services.xserver.videoDrivers = ["modesetting"];
|
2022-02-08 08:55:28 +00:00
|
|
|
nix.settings.cores = 4;
|
2022-01-29 16:24:31 +00:00
|
|
|
|
|
|
|
# Disable kernel mitigations
|
2022-03-22 07:37:15 +00:00
|
|
|
#
|
2022-01-29 16:24:31 +00:00
|
|
|
# Rationale:
|
|
|
|
# - device has a limited workload, consisting mostly of running trusted code and visiting trusted websites with an advertisement blocker
|
|
|
|
# - device is battery powered (we want to spend more time in an idle state, as opposed to running user code or mitigating cpu bugs)
|
|
|
|
# - device is also not involved in any sort of virtualization
|
2022-06-12 15:39:15 +00:00
|
|
|
boot.kernelParams = ["mitigations=off"];
|
2022-01-29 16:24:31 +00:00
|
|
|
# use the lowest frequency possible, to save power
|
|
|
|
powerManagement.cpuFreqGovernor = "powersave";
|
2022-01-29 17:29:16 +00:00
|
|
|
# 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"
|
|
|
|
'';
|
2022-03-17 18:30:18 +00:00
|
|
|
services.thermald.enable = true;
|
|
|
|
boot.extraModprobeConfig = ''
|
2022-01-29 17:29:16 +00:00
|
|
|
# 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
|
|
|
|
'';
|
|
|
|
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"];
|
2022-04-20 11:44:59 +00:00
|
|
|
nix.settings.max-jobs = 4;
|
|
|
|
nix.daemonCPUSchedPolicy = "idle";
|
|
|
|
nix.daemonIOSchedClass = "idle";
|
2022-07-10 13:45:25 +00:00
|
|
|
nix.settings.system-features = [
|
2022-04-20 11:44:59 +00:00
|
|
|
"kvm"
|
|
|
|
"nixos-test"
|
|
|
|
"big-parallel"
|
|
|
|
"benchmark"
|
|
|
|
"gccarch-skylake"
|
|
|
|
"ca-derivations"
|
|
|
|
];
|
2022-12-11 17:01:26 +00:00
|
|
|
services.joycond.enable = true;
|
2022-12-11 19:43:40 +00:00
|
|
|
hardware.bluetooth.enable = true;
|
|
|
|
services.blueman.enable = true;
|
2022-01-29 14:50:06 +00:00
|
|
|
}
|