nix/nixos/foxtrot/default.nix

128 lines
3.2 KiB
Nix
Raw Normal View History

2023-10-09 15:09:02 -05:00
{
flake,
inputs,
outputs,
lib,
# config,
pkgs,
...
}: {
networking.hostName = "foxtrot";
imports =
[
inputs.disko.nixosModules.disko
flake.diskoConfigurations.standard
]
++ (with outputs.nixosModules; [
desktop-usage
podman
postgres
wifi
])
++ [
2023-11-13 09:10:04 -06:00
inputs.hardware.nixosModules.framework-13-7040-amd
2023-10-09 15:09:02 -05:00
];
2023-11-21 10:36:19 -06:00
swapDevices = [
# TODO: move this to disko?
# sudo btrfs subvolume create /swap
# sudo btrfs filesystem mkswapfile --size 32g --uuid clear /swap/swapfile
# sudo swapon /swap/swapfile
{device = "/swap/swapfile";}
];
# findmnt -no UUID -T /swap/swapfile
boot.resumeDevice = "/dev/disk/by-uuid/3076912c-ac61-4067-b6b2-361f68b2d038";
services.logind = {
lidSwitch = "suspend-then-hibernate";
extraConfig = ''
HandlePowerKey=suspend-then-hibernate
IdleAction=suspend-then-hibernate
IdleActionSec=10m
2023-11-21 10:36:19 -06:00
'';
};
2023-11-29 21:27:15 -06:00
systemd.sleep.extraConfig = "HibernateDelaySec=90m";
2023-10-09 15:09:02 -05:00
2023-11-21 10:14:58 -06:00
services.fwupd.enable = true;
services.fwupd.extraRemotes = ["lvfs-testing"];
hardware.opengl.extraPackages = [
# pkgs.rocmPackages.clr.icd
2023-11-21 10:14:58 -06:00
pkgs.amdvlk
# encoding/decoding acceleration
pkgs.libvdpau-va-gl
pkgs.vaapiVdpau
];
2023-11-17 05:32:47 -06:00
hardware.wirelessRegulatoryDatabase = true;
2023-10-09 15:09:02 -05:00
boot = {
2023-11-29 21:27:15 -06:00
kernelPackages = pkgs.linuxPackages_latest; # seeing if using the stable kernel makes wow work
2023-10-09 15:09:02 -05:00
loader = {
efi.canTouchEfiVariables = true;
systemd-boot.enable = true;
};
2023-11-29 21:27:15 -06:00
2023-11-21 10:36:19 -06:00
# sudo filefrag -v /swap/swapfile | awk '$1=="0:" {print substr($4, 1, length($4)-2)}'
# the above won't work for btrfs, instead you need
# btrfs inspect-internal map-swapfile -r /swap/swapfile
# https://wiki.archlinux.org/title/Power_management/Suspend_and_hibernate#Hibernation_into_swap_file
2023-11-13 09:10:04 -06:00
# many of these come from https://wiki.archlinux.org/title/Framework_Laptop_13#Suspend
2023-11-13 17:24:52 -06:00
kernelParams = [
2023-11-29 21:27:15 -06:00
"amdgpu.sg_display=0"
2023-11-13 17:24:52 -06:00
"acpi_osi=\"!Windows 2020\""
2023-11-21 10:36:19 -06:00
"resume_offset=39331072"
2023-11-21 10:14:58 -06:00
# "nvme.noacpi=1" # maybe causing crashes upon waking?
2023-11-29 21:27:15 -06:00
"rtc_cmos.use_acpi_alarm=1"
2023-11-13 17:24:52 -06:00
];
initrd.availableKernelModules = ["xhci_pci" "nvme" "thunderbolt"];
kernelModules = ["kvm-amd"];
2023-11-17 05:32:47 -06:00
extraModprobeConfig = ''
options cfg80211 ieee80211_regdom="US"
'';
2023-10-09 15:09:02 -05:00
};
2023-11-29 21:27:15 -06:00
hardware.bluetooth = {
enable = true;
powerOnBoot = false;
};
powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand";
2023-10-09 15:09:02 -05:00
services.printing.enable = true;
2023-10-26 13:55:08 -05:00
services.fprintd = {
2023-11-13 09:10:04 -06:00
enable = false;
2023-10-26 14:58:03 -05:00
# tod.enable = true;
2023-10-26 13:55:08 -05:00
# tod.driver = pkgs.libfprint-2-tod1-goodix;
};
2023-11-17 05:36:19 -06:00
services.power-profiles-daemon = {
2023-11-29 21:27:15 -06:00
enable = false;
2023-11-17 05:36:19 -06:00
};
services.tlp = {
2023-11-29 21:27:15 -06:00
enable = true;
settings = {
2023-10-26 13:55:08 -05:00
CPU_ENERGY_PERF_POLICY_ON_BAT = "power";
2023-11-29 21:27:15 -06:00
CPU_SCALING_GOVERNOR_ON_BAT = "ondemand";
2023-10-26 13:55:08 -05:00
CPU_MIN_PERF_ON_BAT = 0;
CPU_MAX_PERF_ON_BAT = 60;
2023-10-09 15:09:02 -05:00
2023-10-26 13:55:08 -05:00
CPU_SCALING_GOVERNOR_ON_AC = "performance";
CPU_ENERGY_PERF_POLICY_ON_AC = "performance";
CPU_MIN_PERF_ON_AC = 0;
CPU_MAX_PERF_ON_AC = 100;
};
};
powerManagement.powertop.enable = true;
2023-10-17 23:37:05 -05:00
2023-10-09 15:09:02 -05:00
networking = {
firewall = {
enable = true;
allowPing = true;
allowedTCPPorts = [22];
allowedUDPPorts = [];
};
};
2023-12-04 09:14:13 -06:00
system.stateVersion = "24.05";
2023-10-09 15:09:02 -05:00
}