nix/nixos/foxtrot.nix

233 lines
6 KiB
Nix
Raw Normal View History

2023-10-09 15:09:02 -05:00
{
2024-03-24 14:34:44 -05:00
# lib,
2023-10-09 15:09:02 -05:00
inputs,
outputs,
pkgs,
...
2024-01-04 22:24:18 -06:00
}: let
2024-03-29 09:45:18 -05:00
scale = 1.25;
2024-01-04 22:24:18 -06:00
in {
2023-10-09 15:09:02 -05:00
networking.hostName = "foxtrot";
2024-03-29 10:15:54 -05:00
# TODO: I currently have issues with wifi after resuming from hibernation sometimes.
# I have to modprobe remove and re-add the wifi module to resolve. Mildly annoying.
2024-01-06 11:43:30 -06:00
imports = with outputs.nixosModules; [
2024-03-24 14:34:44 -05:00
{
nixpkgs.overlays = [
outputs.overlays.modifications
];
}
outputs.diskoConfigurations.standard
2024-01-06 11:43:30 -06:00
inputs.hardware.nixosModules.framework-13-7040-amd
desktop-usage
2024-02-02 00:00:54 -06:00
# gnome
2024-03-09 10:43:27 -06:00
printing
2024-03-29 09:45:18 -05:00
kde-plasma
2024-01-06 11:43:30 -06:00
podman
2024-01-16 21:14:14 -06:00
lutris
2024-01-30 19:36:52 -06:00
# postgres
2024-01-06 11:43:30 -06:00
wifi
2024-03-22 09:54:00 -05:00
hyprland
2024-03-29 10:51:39 -05:00
steam
2024-03-19 10:25:29 -05:00
{
# laptop power management
services.upower.enable = true;
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";
systemd.sleep.extraConfig = "HibernateDelaySec=30m";
services.fwupd.enable = true;
# source: https://github.com/NixOS/nixos-hardware/tree/master/framework/13-inch/7040-amd#getting-the-fingerprint-sensor-to-work
# we need fwupd 1.9.7 to downgrade the fingerprint sensor firmware
# services.fwupd.package =
# (import (builtins.fetchTarball {
# url = "https://github.com/NixOS/nixpkgs/archive/bb2009ca185d97813e75736c2b8d1d8bb81bde05.tar.gz";
# sha256 = "sha256:003qcrsq5g5lggfrpq31gcvj82lb065xvr7bpfa8ddsw8x4dnysk";
# }) {
# inherit (pkgs) system;
# })
# .fwupd;
services.fwupd.extraRemotes = ["lvfs-testing"];
services.logind = {
lidSwitch = "suspend-then-hibernate";
# HandleLidSwitchDocked=ignore
extraConfig = ''
HandlePowerKey=suspend-then-hibernate
IdleActionSec=10m
IdleAction=suspend-then-hibernate
'';
};
}
2024-01-06 11:43:30 -06:00
];
2023-10-09 15:09:02 -05:00
2024-01-13 14:38:31 -06:00
environment = {
systemPackages = with pkgs; [
2024-03-09 10:37:51 -06:00
steam
2024-01-30 19:36:52 -06:00
spotify
discord
slack
2024-02-05 10:01:14 -06:00
godot_4
2024-02-20 17:13:43 -06:00
fractal
2024-02-21 20:10:10 -06:00
prismlauncher
2024-03-13 21:34:27 -05:00
upower
acpi
prismlauncher
2024-01-13 14:38:31 -06:00
radeontop
sops
2024-02-02 00:00:54 -06:00
obs-studio
2024-02-21 22:59:49 -06:00
xh
2024-01-13 14:38:31 -06:00
];
};
2024-01-04 22:24:18 -06:00
home-manager.users.daniel = {
imports = with outputs.homeManagerModules; [
sway
2024-01-05 13:23:43 -06:00
pass
2024-01-24 22:02:50 -06:00
firefox-no-tabs
2024-03-09 10:37:51 -06:00
# wallpaper-manager
2024-03-24 20:39:24 -05:00
hyprland
2024-01-04 22:24:18 -06:00
];
home = {
stateVersion = "24.05";
2024-02-28 22:00:42 -06:00
pointerCursor = {
size = 40;
};
2024-01-04 22:24:18 -06:00
};
wayland.windowManager.hyprland = {
settings = {
2024-03-27 23:01:40 -05:00
env = [
"EWW_BAR_MON,0"
];
2024-01-04 22:24:18 -06:00
# See https://wiki.hyprland.org/Configuring/Keywords/ for more
monitor = [
"eDP-1,2256x1504@60,0x0,${toString scale}"
];
};
};
wayland.windowManager.sway = {
config = {
output = {
"BOE 0x0BCA Unknown" = {
mode = "2256x1504@60Hz";
2024-01-13 14:38:31 -06:00
position = "0,0";
2024-01-04 22:24:18 -06:00
scale = toString scale;
};
2024-01-13 14:38:31 -06:00
"Dell Inc. DELL U2720Q D3TM623" = {
# desktop left vertical monitor
mode = "1920x1080@60Hz";
# transform = "90";
# scale = "1.5";
position = "${toString (builtins.floor (2256 / scale))},0";
};
2024-01-04 22:24:18 -06:00
};
};
};
};
2023-11-21 10:14:58 -06:00
hardware.opengl.extraPackages = [
# pkgs.rocmPackages.clr.icd
2023-11-21 10:14:58 -06:00
pkgs.amdvlk
2024-01-30 19:36:52 -06:00
2023-11-21 10:14:58 -06:00
# encoding/decoding acceleration
pkgs.libvdpau-va-gl
pkgs.vaapiVdpau
];
networking.networkmanager.wifi.powersave = false;
2023-11-17 05:32:47 -06:00
hardware.wirelessRegulatoryDatabase = true;
2023-12-17 09:58:06 -06:00
hardware.framework.amd-7040.preventWakeOnAC = true;
2023-10-09 15:09:02 -05:00
boot = {
2024-01-04 22:15:55 -06:00
kernelPackages = pkgs.linuxPackages_latest;
2023-11-29 21:27:15 -06:00
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-12-04 09:34:13 -06:00
# NOTE(oninstall):
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 = [
2024-01-30 19:36:52 -06:00
"rtc_cmos.use_acpi_alarm=1"
2023-11-29 21:27:15 -06:00
"amdgpu.sg_display=0"
2023-11-13 17:24:52 -06:00
"acpi_osi=\"!Windows 2020\""
2024-01-30 19:36:52 -06:00
# "nvme.noacpi=1" # maybe causing crashes upon waking?
2023-12-04 09:34:13 -06:00
# NOTE(oninstall):
"resume_offset=3421665"
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;
2024-01-04 22:15:55 -06:00
# TODO: when resuming from hibernation, it would be nice if this would
# simply resume the power state at the time of hibernation
2023-11-29 21:27:15 -06:00
powerOnBoot = false;
};
2024-01-30 19:36:52 -06:00
powerManagement.cpuFreqGovernor = "ondemand";
powerManagement.resumeCommands = ''
modprobe -rv mt7921e
modprobe -v mt7921e
'';
2023-12-04 17:50:54 -06:00
2024-01-04 22:15:55 -06:00
services.power-profiles-daemon = {
enable = true;
};
2023-10-26 13:55:08 -05:00
services.fprintd = {
2024-01-30 19:36:52 -06:00
enable = true;
2024-03-24 14:42:02 -05:00
package = pkgs.fprintd.overrideAttrs {
# Source: https://github.com/NixOS/nixpkgs/commit/87ca2dc071581aea0e691c730d6844f1beb07c9f
mesonCheckFlags = [
# PAM related checks are timing out
"--no-suite"
"fprintd:TestPamFprintd"
];
};
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;
};
2024-01-30 19:36:52 -06:00
# services.tlp = {
# enable = true;
# 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 = 80;
# 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;
# };
# };
2023-10-09 15:09:02 -05:00
2024-01-19 09:39:21 -06:00
networking.firewall.allowedTCPPorts = [
8000 # dev stuff
];
2023-12-04 09:14:13 -06:00
system.stateVersion = "24.05";
2023-10-09 15:09:02 -05:00
}