268 lines
7.1 KiB
HolyC
268 lines
7.1 KiB
HolyC
{ config, pkgs, ... }:
|
|
|
|
{
|
|
imports = [ ./hardware-configuration.nix ];
|
|
|
|
boot.loader.systemd-boot.enable = true;
|
|
boot.loader.systemd-boot.configurationLimit = 3;
|
|
boot.loader.efi.canTouchEfiVariables = true;
|
|
boot.loader.timeout = 0;
|
|
|
|
networking.hostName = "framework";
|
|
|
|
hardware.bluetooth = {
|
|
enable = true;
|
|
powerOnBoot = true;
|
|
settings = {
|
|
General = {
|
|
Experimental = true; # Show battery charge of Bluetooth devices
|
|
};
|
|
};
|
|
};
|
|
|
|
networking.networkmanager.enable = true;
|
|
|
|
services.resolved.enable = true;
|
|
|
|
networking.firewall.enable = true;
|
|
# Required for Tailscale
|
|
networking.firewall.checkReversePath = "loose";
|
|
|
|
services.tailscale.enable = true;
|
|
|
|
time.timeZone = "America/Los_Angeles";
|
|
i18n.defaultLocale = "en_US.UTF-8";
|
|
|
|
services.xserver.enable = true;
|
|
|
|
# Framework Laptop 13 AMD AI 300 Series specific configurations
|
|
# Enable AMD GPU support and power management
|
|
hardware.graphics = {
|
|
enable = true;
|
|
enable32Bit = true;
|
|
# Add OpenCL support via Rusticl (recommended by NixOS wiki for DaVinci Resolve)
|
|
extraPackages = with pkgs; [ mesa.opencl ];
|
|
};
|
|
|
|
# Enable keyd for key remapping
|
|
services.keyd = {
|
|
enable = true;
|
|
keyboards = {
|
|
default = {
|
|
ids = [ "*" ]; # Apply to all keyboards
|
|
settings = {
|
|
main = {
|
|
capslock = "esc";
|
|
esc = "capslock";
|
|
leftalt = "leftcontrol";
|
|
leftcontrol = "leftalt";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
# Prevent trackpad interference with keyd
|
|
environment.etc."libinput/local-overrides.quirks".text = ''
|
|
[Serial Keyboards]
|
|
MatchUdevType=keyboard
|
|
MatchName=keyd virtual keyboard
|
|
AttrKeyboardIntegration=internal
|
|
'';
|
|
|
|
# Set Kitty as default terminal
|
|
xdg.terminal-exec = {
|
|
enable = true;
|
|
settings = {
|
|
default = [ "kitty.desktop" ];
|
|
};
|
|
};
|
|
|
|
services.displayManager.gdm.enable = true;
|
|
services.desktopManager.gnome.enable = true;
|
|
|
|
# Remove default GNOME apps (keeping loupe and file-roller)
|
|
environment.gnome.excludePackages = with pkgs; [
|
|
epiphany # GNOME Web
|
|
gnome-calculator
|
|
gnome-calendar
|
|
gnome-characters
|
|
gnome-clocks
|
|
gnome-connections
|
|
gnome-console
|
|
gnome-contacts
|
|
gnome-maps
|
|
gnome-music
|
|
gnome-weather
|
|
snapshot # Camera
|
|
gnome-text-editor
|
|
simple-scan
|
|
totem # Videos (have VLC)
|
|
yelp # Help docs
|
|
evince # PDF viewer (using Zen Browser)
|
|
geary # Email
|
|
gnome-tour
|
|
gnome-font-viewer # Have font-manager
|
|
nautilus # Using Nemo
|
|
];
|
|
|
|
services.xserver.xkb = {
|
|
layout = "us";
|
|
variant = "";
|
|
};
|
|
|
|
services.printing.enable = true;
|
|
|
|
services.pulseaudio.enable = false;
|
|
security.rtkit.enable = true;
|
|
services.pipewire = {
|
|
enable = true;
|
|
alsa.enable = true;
|
|
alsa.support32Bit = true;
|
|
pulse.enable = true;
|
|
};
|
|
users.users.jet = {
|
|
isNormalUser = true;
|
|
description = "Jet";
|
|
extraGroups = [
|
|
"networkmanager"
|
|
"wheel"
|
|
"video"
|
|
"render"
|
|
];
|
|
};
|
|
|
|
nixpkgs.config.allowUnfree = true;
|
|
nix.settings = {
|
|
experimental-features = [
|
|
"nix-command"
|
|
"flakes"
|
|
];
|
|
auto-optimise-store = true;
|
|
max-jobs = "auto";
|
|
cores = 0;
|
|
build-users-group = "nixbld";
|
|
};
|
|
|
|
# Framework-specific services
|
|
# Enable fwupd for BIOS updates (distributed through LVFS)
|
|
services.fwupd.enable = true;
|
|
|
|
# Enable periodic TRIM for NVMe/SSD health
|
|
services.fstrim.enable = true;
|
|
|
|
# Keep only last 10 generations, GC everything else (daily)
|
|
systemd.services.nix-cleanup = {
|
|
description = "Nix generation cleanup and garbage collection";
|
|
serviceConfig.Type = "oneshot";
|
|
script = ''
|
|
${pkgs.nix}/bin/nix-env --delete-generations +3 -p /nix/var/nix/profiles/system
|
|
${pkgs.nix}/bin/nix-env --delete-generations +3 -p /nix/var/nix/profiles/per-user/jet/home-manager || true
|
|
${pkgs.nix}/bin/nix-store --gc
|
|
'';
|
|
};
|
|
systemd.timers.nix-cleanup = {
|
|
wantedBy = [ "timers.target" ];
|
|
timerConfig = {
|
|
OnCalendar = "daily";
|
|
Persistent = true;
|
|
};
|
|
};
|
|
|
|
# Power management for laptop
|
|
# Configure lid switch behavior - suspend (no swap needed with 96GB RAM)
|
|
services.logind = {
|
|
settings = {
|
|
Login = {
|
|
HandleLidSwitch = "suspend";
|
|
HandleLidSwitchExternalPower = "suspend";
|
|
HandleLidSwitchDocked = "ignore";
|
|
};
|
|
};
|
|
};
|
|
|
|
# Enable auto-cpufreq for intelligent power management (replaces TLP)
|
|
services.auto-cpufreq.enable = true;
|
|
services.auto-cpufreq.settings = {
|
|
battery = {
|
|
governor = "powersave";
|
|
turbo = "never";
|
|
};
|
|
charger = {
|
|
governor = "performance";
|
|
turbo = "auto";
|
|
};
|
|
};
|
|
|
|
# Enable thermald for thermal management
|
|
services.thermald.enable = true;
|
|
|
|
# Framework Laptop 13 specific power optimizations
|
|
# Enable power-profiles-daemon for better AMD power management
|
|
# (Note: This conflicts with auto-cpufreq, so we'll keep auto-cpufreq disabled)
|
|
services.power-profiles-daemon.enable = false;
|
|
|
|
# AMD specific power management
|
|
powerManagement.cpuFreqGovernor = "powersave";
|
|
|
|
# Enable power management
|
|
powerManagement.enable = true;
|
|
|
|
# v4l2loopback for OBS Virtual Camera
|
|
boot.extraModulePackages = with config.boot.kernelPackages; [ v4l2loopback ];
|
|
boot.kernelModules = [ "v4l2loopback" ];
|
|
boot.extraModprobeConfig = ''
|
|
options v4l2loopback devices=1 video_nr=1 card_label="OBS Virtual Camera" exclusive_caps=1
|
|
'';
|
|
|
|
# RAM optimizations for 96GB system
|
|
boot.kernel.sysctl = {
|
|
"vm.swappiness" = 0; # Never swap to disk
|
|
"vm.vfs_cache_pressure" = 50; # Keep more filesystem cache in RAM
|
|
"vm.dirty_ratio" = 15; # Write to disk when 15% of RAM is dirty
|
|
"vm.dirty_background_ratio" = 5; # Start writing when 5% dirty
|
|
};
|
|
|
|
# Use RAM disk (tmpfs) for temporary files - much faster than disk
|
|
fileSystems."/tmp" = {
|
|
device = "tmpfs";
|
|
fsType = "tmpfs";
|
|
options = [
|
|
"size=32G" # Use up to 32GB RAM for /tmp (adjust as needed)
|
|
"mode=1777"
|
|
"nosuid"
|
|
"nodev"
|
|
];
|
|
};
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
git
|
|
wget
|
|
nh
|
|
];
|
|
|
|
programs.steam.enable = true;
|
|
programs.nix-index-database.comma.enable = true;
|
|
|
|
# https://wiki.nixos.org/wiki/Appimage
|
|
programs.appimage = {
|
|
enable = true;
|
|
binfmt = true;
|
|
};
|
|
|
|
# GameCube adapter udev rules for Slippi/Dolphin
|
|
# Disable USB autosuspend for Framework's problematic devices (fingerprint reader, USB-C hub)
|
|
services.udev.extraRules = ''
|
|
# GameCube adapter USB device (vendor ID 057e, product ID 0337)
|
|
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTRS{idVendor}=="057e", ATTRS{idProduct}=="0337", MODE="0666"
|
|
# GameCube adapter HID device (needed for Dolphin to access controllers)
|
|
KERNEL=="hidraw*", ATTRS{idVendor}=="057e", ATTRS{idProduct}=="0337", MODE="0666", GROUP="input"
|
|
# Disable autosuspend for Framework fingerprint reader
|
|
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="27a6", ATTR{power/autosuspend}="-1"
|
|
# Disable autosuspend for Framework USB-C hub controllers
|
|
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="32ac", ATTR{power/autosuspend}="-1"
|
|
'';
|
|
|
|
system.stateVersion = "25.05";
|
|
|
|
}
|