190 lines
5.3 KiB
Nix
190 lines
5.3 KiB
Nix
{
|
|
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
|
|
# hyprland
|
|
])
|
|
++ [
|
|
inputs.hardware.nixosModules.framework-13-7040-amd
|
|
];
|
|
|
|
# use updated ppd for framework 13:
|
|
# source: https://community.frame.work/t/tracking-ppd-v-tlp-for-amd-ryzen-7040/39423/137?u=lytedev
|
|
nixpkgs.overlays = [
|
|
(
|
|
final: prev: {
|
|
power-profiles-daemon = prev.power-profiles-daemon.overrideAttrs (
|
|
old: {
|
|
version = "0.13-1";
|
|
|
|
patches =
|
|
(old.patches or [])
|
|
++ [
|
|
(prev.fetchpatch {
|
|
url = "https://gitlab.freedesktop.org/upower/power-profiles-daemon/-/merge_requests/127.patch";
|
|
sha256 = "sha256-jnq5yJvWQHOlZ78SE/4/HqiQfF25YHQH/T4wwDVRHR0=";
|
|
})
|
|
(prev.fetchpatch {
|
|
url = "https://gitlab.freedesktop.org/upower/power-profiles-daemon/-/merge_requests/128.patch";
|
|
sha256 = "sha256-YD9wn9IQlCp02r4lmwRnx9Eur2VVP1JfC/Bm8hlzF3Q=";
|
|
})
|
|
(prev.fetchpatch {
|
|
url = "https://gitlab.freedesktop.org/upower/power-profiles-daemon/-/merge_requests/129.patch";
|
|
sha256 = "sha256-9T+I3BAUW3u4LldF85ctE0/PLu9u+KBN4maoL653WJU=";
|
|
})
|
|
];
|
|
|
|
# explicitly fetching the source to make sure we're patching over 0.13 (this isn't strictly needed):
|
|
src = prev.fetchFromGitLab {
|
|
domain = "gitlab.freedesktop.org";
|
|
owner = "hadess";
|
|
repo = "power-profiles-daemon";
|
|
rev = "0.13";
|
|
sha256 = "sha256-ErHy+shxZQ/aCryGhovmJ6KmAMt9OZeQGDbHIkC0vUE=";
|
|
};
|
|
}
|
|
);
|
|
}
|
|
)
|
|
];
|
|
|
|
swapDevices = [
|
|
# TODO: move this to disko?
|
|
# NOTE(oninstall):
|
|
# 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/81c3354a-f629-4b6b-a249-7705aeb9f0d5";
|
|
|
|
services.logind = {
|
|
lidSwitch = "suspend-then-hibernate";
|
|
extraConfig = ''
|
|
HandlePowerKey=suspend-then-hibernate
|
|
IdleAction=suspend-then-hibernate
|
|
IdleActionSec=10m
|
|
'';
|
|
};
|
|
systemd.sleep.extraConfig = "HibernateDelaySec=90m";
|
|
|
|
services.fwupd.enable = true;
|
|
services.fwupd.extraRemotes = ["lvfs-testing"];
|
|
|
|
hardware.opengl.extraPackages = [
|
|
# pkgs.rocmPackages.clr.icd
|
|
pkgs.amdvlk
|
|
# encoding/decoding acceleration
|
|
pkgs.libvdpau-va-gl
|
|
pkgs.vaapiVdpau
|
|
];
|
|
|
|
hardware.wirelessRegulatoryDatabase = true;
|
|
|
|
hardware.framework.amd-7040.preventWakeOnAC = true;
|
|
|
|
boot = {
|
|
kernelPackages = pkgs.linuxPackages_latest; # seeing if using the stable kernel makes wow work
|
|
|
|
loader = {
|
|
efi.canTouchEfiVariables = true;
|
|
systemd-boot.enable = true;
|
|
};
|
|
|
|
# NOTE(oninstall):
|
|
# 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
|
|
# many of these come from https://wiki.archlinux.org/title/Framework_Laptop_13#Suspend
|
|
kernelParams = [
|
|
"amdgpu.sg_display=0"
|
|
"acpi_osi=\"!Windows 2020\""
|
|
# NOTE(oninstall):
|
|
"resume_offset=3421665"
|
|
# "nvme.noacpi=1" # maybe causing crashes upon waking?
|
|
"rtc_cmos.use_acpi_alarm=1"
|
|
];
|
|
initrd.availableKernelModules = ["xhci_pci" "nvme" "thunderbolt"];
|
|
kernelModules = ["kvm-amd"];
|
|
extraModprobeConfig = ''
|
|
options cfg80211 ieee80211_regdom="US"
|
|
'';
|
|
};
|
|
hardware.bluetooth = {
|
|
enable = true;
|
|
powerOnBoot = false;
|
|
};
|
|
powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand";
|
|
services.printing.enable = true;
|
|
services.printing.browsing = true;
|
|
services.printing.browsedConf = ''
|
|
BrowseDNSSDSubTypes _cups,_print
|
|
BrowseLocalProtocols all
|
|
BrowseRemoteProtocols all
|
|
CreateIPPPrinterQueues All
|
|
|
|
BrowseProtocols all
|
|
'';
|
|
services.printing.drivers = [pkgs.gutenprint];
|
|
services.avahi = {
|
|
enable = true;
|
|
reflector = true;
|
|
openFirewall = true;
|
|
nssmdns = true;
|
|
};
|
|
|
|
services.fprintd = {
|
|
enable = false;
|
|
# tod.enable = true;
|
|
# tod.driver = pkgs.libfprint-2-tod1-goodix;
|
|
};
|
|
services.power-profiles-daemon = {
|
|
enable = true;
|
|
};
|
|
services.tlp = {
|
|
enable = false;
|
|
settings = {
|
|
CPU_ENERGY_PERF_POLICY_ON_BAT = "power";
|
|
CPU_SCALING_GOVERNOR_ON_BAT = "ondemand";
|
|
CPU_MIN_PERF_ON_BAT = 0;
|
|
CPU_MAX_PERF_ON_BAT = 60;
|
|
|
|
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;
|
|
|
|
networking = {
|
|
firewall = {
|
|
enable = true;
|
|
allowPing = true;
|
|
allowedTCPPorts = [22];
|
|
allowedUDPPorts = [];
|
|
};
|
|
};
|
|
|
|
system.stateVersion = "24.05";
|
|
}
|