nix/nixos/foxtrot.nix

487 lines
14 KiB
Nix
Raw Normal View History

{pkgs, ...}:
/*
## source: https://community.frame.work/t/speakers-sound-quality/1078/82
let
pipewire-speakers-profile-json = ''{
"output": {
"blocklist": [],
"equalizer": {
"balance": 0.0,
"bypass": false,
"input-gain": 0.0,
"left": {
"band0": {
"frequency": 100.0,
"gain": 0.0,
"mode": "RLC (BT)",
"mute": false,
"q": 1.0,
"slope": "x4",
"solo": false,
"type": "Hi-pass"
},
"band1": {
"frequency": 150.0,
"gain": 4.02,
"mode": "RLC (BT)",
"mute": false,
"q": 3.0,
"slope": "x1",
"solo": false,
"type": "Bell"
},
"band2": {
"frequency": 600.0,
"gain": -5.07,
"mode": "RLC (BT)",
"mute": false,
"q": 4.000000000000008,
"slope": "x1",
"solo": false,
"type": "Bell"
},
"band3": {
"frequency": 1200.0,
"gain": -3.49,
"mode": "RLC (BT)",
"mute": false,
"q": 4.17,
"slope": "x1",
"solo": false,
"type": "Bell"
},
"band4": {
"frequency": 2000.0,
"gain": 1.43,
"mode": "RLC (BT)",
"mute": false,
"q": 4.0,
"slope": "x1",
"solo": false,
"type": "Bell"
},
"band5": {
"frequency": 5300.0,
"gain": 3.84,
"mode": "RLC (BT)",
"mute": false,
"q": 2.64,
"slope": "x1",
"solo": false,
"type": "Bell"
},
"band6": {
"frequency": 6000.0,
"gain": 4.02,
"mode": "RLC (BT)",
"mute": false,
"q": 4.36,
"slope": "x1",
"solo": false,
"type": "Hi-shelf"
},
"band7": {
"frequency": 7500.0,
"gain": -2.09,
"mode": "RLC (BT)",
"mute": false,
"q": 3.0,
"slope": "x1",
"solo": false,
"type": "Bell"
},
"band8": {
"frequency": 8000.0,
"gain": 2.01,
"mode": "RLC (BT)",
"mute": false,
"q": 4.36,
"slope": "x1",
"solo": false,
"type": "Bell"
},
"band9": {
"frequency": 900.0,
"gain": -4.12,
"mode": "RLC (BT)",
"mute": false,
"q": 5.909999999999967,
"slope": "x1",
"solo": false,
"type": "Bell"
}
},
"mode": "IIR",
"num-bands": 10,
"output-gain": -1.5,
"pitch-left": 0.0,
"pitch-right": 0.0,
"right": {
"band0": {
"frequency": 100.0,
"gain": 0.0,
"mode": "RLC (BT)",
"mute": false,
"q": 1.0,
"slope": "x4",
"solo": false,
"type": "Hi-pass"
},
"band1": {
"frequency": 150.0,
"gain": 4.02,
"mode": "RLC (BT)",
"mute": false,
"q": 3.0,
"slope": "x1",
"solo": false,
"type": "Bell"
},
"band2": {
"frequency": 600.0,
"gain": -5.07,
"mode": "RLC (BT)",
"mute": false,
"q": 4.000000000000008,
"slope": "x1",
"solo": false,
"type": "Bell"
},
"band3": {
"frequency": 1200.0,
"gain": -3.49,
"mode": "RLC (BT)",
"mute": false,
"q": 4.17,
"slope": "x1",
"solo": false,
"type": "Bell"
},
"band4": {
"frequency": 2000.0,
"gain": 1.43,
"mode": "RLC (BT)",
"mute": false,
"q": 4.0,
"slope": "x1",
"solo": false,
"type": "Bell"
},
"band5": {
"frequency": 5300.0,
"gain": 3.84,
"mode": "RLC (BT)",
"mute": false,
"q": 2.64,
"slope": "x1",
"solo": false,
"type": "Bell"
},
"band6": {
"frequency": 6000.0,
"gain": 4.02,
"mode": "RLC (BT)",
"mute": false,
"q": 4.36,
"slope": "x1",
"solo": false,
"type": "Hi-shelf"
},
"band7": {
"frequency": 7500.0,
"gain": -2.09,
"mode": "RLC (BT)",
"mute": false,
"q": 3.0,
"slope": "x1",
"solo": false,
"type": "Bell"
},
"band8": {
"frequency": 8000.0,
"gain": 2.01,
"mode": "RLC (BT)",
"mute": false,
"q": 4.36,
"slope": "x1",
"solo": false,
"type": "Bell"
},
"band9": {
"frequency": 900.0,
"gain": -4.12,
"mode": "RLC (BT)",
"mute": false,
"q": 5.909999999999967,
"slope": "x1",
"solo": false,
"type": "Bell"
}
},
"split-channels": false
},
"loudness": {
"bypass": false,
"clipping": false,
"clipping-range": 6.0,
"fft": "4096",
"input-gain": 0.0,
"output-gain": 0.0,
"std": "ISO226-2003",
"volume": 6.999999999999991
},
"plugins_order": [
"loudness",
"equalizer"
]
}
}'';
in
*/
{
2024-06-28 21:36:19 -05:00
imports = [
2024-07-29 11:29:20 -05:00
{
system.stateVersion = "24.05";
home-manager.users.daniel.home.stateVersion = "24.05";
networking.hostName = "foxtrot";
}
2024-03-19 10:25:29 -05:00
{
swapDevices = [
# TODO: move this to disko?
# NOTE(oninstall):
2024-09-12 11:58:24 -05:00
/*
sudo btrfs subvolume create /swap
sudo btrfs filesystem mkswapfile --size 32g --uuid clear /swap/swapfile
sudo swapon /swap/swapfile
*/
2024-03-19 10:25:29 -05:00
{device = "/swap/swapfile";}
];
# findmnt -no UUID -T /swap/swapfile
boot.resumeDevice = "/dev/disk/by-uuid/81c3354a-f629-4b6b-a249-7705aeb9f0d5";
2024-11-03 14:48:41 -06:00
# systemd.sleep.extraConfig = "HibernateDelaySec=180m";
2024-03-19 10:25:29 -05:00
services.fwupd.enable = true;
services.fwupd.extraRemotes = ["lvfs-testing"];
}
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-12-06 08:22:35 -06:00
easyeffects
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-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 = {
home = {
2024-02-28 22:00:42 -06:00
pointerCursor = {
size = 40;
};
2024-01-04 22:24:18 -06:00
};
2024-12-06 08:22:35 -06:00
services.easyeffects = {
enable = true;
preset = "philonmetal";
# clone from https://github.com/ceiphr/ee-framework-presets
# then `cp *.json ~/.config/easyeffects/output`
# TODO: nixify this
};
2024-09-12 11:58:24 -05:00
wayland.windowManager.hyprland = {
settings = {
env = [
"EWW_BAR_MON,0"
];
# See https://wiki.hyprland.org/Configuring/Keywords/ for more
monitor = [
2024-12-02 19:58:12 -06:00
"eDP-1,2880x1920@120Hz,0x0,1.66667"
2024-09-12 11:58:24 -05:00
];
};
};
wayland.windowManager.sway = {
config = {
output = {
2024-09-13 00:46:39 -05:00
"BOE NE135A1M-NY1 Unknown" = {
mode = "2880x1920@120Hz";
2024-09-18 09:43:31 -05:00
position = "1092,2160";
2024-12-02 19:58:12 -06:00
scale = toString (5 / 3);
2024-09-13 00:46:39 -05:00
};
2024-09-18 09:43:31 -05:00
"Dell Inc. DELL U2720Q CWTM623" = {
mode = "3840x2160@60Hz";
position = "0,0";
2024-11-20 09:46:11 -06:00
scale = toString 1.25;
2024-09-18 09:43:31 -05:00
};
2024-09-13 00:46:39 -05:00
/*
2024-09-12 11:58:24 -05:00
"BOE 0x0BCA Unknown" = {
mode = "2256x1504@60Hz";
position = "0,0";
scale = toString scale;
};
"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-09-13 00:46:39 -05:00
*/
2024-09-12 11:58:24 -05:00
};
};
};
2024-06-10 09:56:13 -05:00
};
2024-07-29 10:01:59 -05:00
hardware.graphics.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
];
2024-12-02 17:01:30 -06:00
hardware.amdgpu = {
amdvlk = {
enable = true;
support32Bit = {
enable = true;
};
};
};
networking.networkmanager.wifi.powersave = false;
2023-11-17 05:32:47 -06:00
2023-12-17 09:58:06 -06:00
hardware.framework.amd-7040.preventWakeOnAC = true;
2023-10-09 15:09:02 -05:00
boot = {
2024-11-22 08:13:16 -06:00
# kernelPackages = pkgs.linuxPackages_latest;
2024-06-10 09:56:13 -05:00
# https://github.com/void-linux/void-packages/issues/50417#issuecomment-2131802836 fix framework 13 not shutting down
2024-09-12 11:58:24 -05:00
/*
kernelPatches = [
{
name = "framework13shutdownfix";
patch = builtins.fetchurl {
url = "https://github.com/void-linux/void-packages/files/15445612/0001-Add-hopefully-a-solution-for-shutdown-regression.PATCH";
sha256 = "sha256:10zcnzy5hkam2cnxx441b978gzhvnqlcc49k7bpz9dc28xyjik50";
};
}
];
*/
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):
2024-09-12 11:58:24 -05: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
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-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-11-22 08:13:16 -06:00
package = pkgs.bluez.overrideAttrs (finalAttrs: previousAttrs: rec {
version = "5.78";
src = pkgs.fetchurl {
url = "mirror://kernel/linux/bluetooth/bluez-${version}.tar.xz";
sha256 = "sha256-gw/tGRXF03W43g9eb0X83qDcxf9f+z0x227Q8A1zxeM=";
};
patches = [];
buildInputs =
previousAttrs.buildInputs
++ [
pkgs.python3Packages.pygments
];
});
2023-11-29 21:27:15 -06:00
};
2024-01-30 19:36:52 -06:00
powerManagement.cpuFreqGovernor = "ondemand";
2024-09-12 11:58:24 -05:00
/*
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 = {
enable = false;
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 13:55:08 -05:00
};
2024-01-30 19:36:52 -06:00
2024-09-12 11:58:24 -05: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-06-28 22:54:16 -05:00
networking.firewall.allowedTCPPorts = let
stardewValley = 24642;
2024-11-09 22:12:24 -06:00
factorio = 34197;
2024-06-28 22:54:16 -05:00
in [
2024-01-19 09:39:21 -06:00
8000 # dev stuff
2024-11-09 22:12:24 -06:00
factorio
2024-06-28 22:54:16 -05:00
stardewValley
7777
];
networking.firewall.allowedUDPPorts = let
stardewValley = 24642;
2024-11-09 22:12:24 -06:00
factorio = 34197;
2024-06-28 22:54:16 -05:00
in [
8000 # dev stuff
2024-11-09 22:12:24 -06:00
factorio
2024-06-28 22:54:16 -05:00
stardewValley
2024-06-10 09:56:13 -05:00
7777
2024-01-19 09:39:21 -06:00
];
2023-10-09 15:09:02 -05:00
}