make thinkpad headless

This commit is contained in:
Yan Lin 2025-12-07 21:33:22 +01:00
parent 0b2fd37a07
commit 2450a37916
2 changed files with 11 additions and 113 deletions

View file

@ -1,62 +1,12 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
# Allow unfree packages in home-manager
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
# Import the common NixOS home configuration
imports = [ imports = [
../home-default.nix ../home-default.nix
../../../modules/syncthing.nix ../../../modules/syncthing.nix
../../../modules/tex.nix ../../../modules/tex.nix
../../../modules/gnome/home.nix
../../../modules/firefox.nix
../../../modules/ghostty.nix
../../../modules/papis.nix
../../../modules/libreoffice.nix
../../../modules/schedule.nix ../../../modules/schedule.nix
../../../modules/cursor.nix
];
# Enable Ghostty terminal with OSC-52 clipboard support
programs.ghostty-custom = {
enable = true;
package = pkgs.ghostty;
fontSize = 12;
windowMode = "maximized";
};
# Enable Firefox browser
programs.firefox-custom = {
enable = true;
package = pkgs.firefox;
};
# Enable Cursor editor
programs.cursor.package = pkgs.code-cursor;
# ThinkPad-specific applications
home.packages = with pkgs; [
obsidian
keepassxc
imagemagick
inkscape
vlc
obs-studio
(pkgs.symlinkJoin {
name = "ovito-wrapped";
paths = [ pkgs.ovito ];
buildInputs = [ pkgs.makeWrapper ];
postBuild = ''
wrapProgram $out/bin/ovito \
--set QT_QPA_PLATFORM wayland \
--set MESA_GL_VERSION_OVERRIDE 3.3
'';
})
remmina
chromium
localsend
calibre
zotero
]; ];
} }

View file

@ -4,11 +4,9 @@
imports = [ imports = [
./hardware-configuration.nix ./hardware-configuration.nix
../system-default.nix ../system-default.nix
../../../modules/gnome/system.nix
../../../modules/tailscale.nix ../../../modules/tailscale.nix
../../../modules/login-display.nix ../../../modules/login-display.nix
../../../modules/borg/client.nix ../../../modules/borg/client.nix
../../../modules/logiops.nix
]; ];
# Bootloader - standard UEFI setup # Bootloader - standard UEFI setup
@ -24,13 +22,9 @@
# Kernel parameters for ThinkPad # Kernel parameters for ThinkPad
boot.kernelParams = [ boot.kernelParams = [
# Better power management
"i915.enable_psr=1" "i915.enable_psr=1"
"i915.enable_fbc=1" "i915.enable_fbc=1"
# Disable GPU power management debugging
"drm.debug=0" "drm.debug=0"
# Prefer S3 deep sleep over s2idle
"mem_sleep_default=deep"
]; ];
# Blacklist NVIDIA kernel modules to disable discrete GPU completely # Blacklist NVIDIA kernel modules to disable discrete GPU completely
@ -55,21 +49,8 @@
]; ];
}; };
# Bluetooth support
bluetooth = {
enable = true;
powerOnBoot = true;
settings = {
General = {
Enable = "Source,Sink,Media,Socket";
};
};
};
}; };
# Blueman Bluetooth manager
services.blueman.enable = true;
# Network configuration # Network configuration
networking = { networking = {
hostName = "thinkpad"; hostName = "thinkpad";
@ -81,30 +62,6 @@
}; };
# Sound configuration with PipeWire (better than PulseAudio)
services.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
wireplumber.enable = true;
};
# Touchpad configuration (host-specific overrides)
services.libinput.touchpad = {
disableWhileTyping = true;
accelProfile = "adaptive";
};
# TrackPoint configuration (treated as mouse device)
services.libinput.mouse = {
accelSpeed = "0.0"; # Higher sensitivity for trackpoint (-1.0 to 1.0)
accelProfile = "flat"; # No acceleration curve for precise control
middleEmulation = false; # ThinkPad trackpoints have real middle buttons
};
# Power management for laptops # Power management for laptops
powerManagement = { powerManagement = {
enable = true; enable = true;
@ -143,18 +100,17 @@
}; };
}; };
# Suspend behavior configuration # Disable all suspend/sleep for headless server operation
services.logind.settings = { services.logind = {
Login = { lidSwitch = "ignore";
HandleLidSwitch = "suspend"; # Suspend on lid close (all power modes) lidSwitchExternalPower = "ignore";
HandleLidSwitchDocked = "ignore"; # Don't suspend when docked lidSwitchDocked = "ignore";
HandleLidSwitchExternalPower = "ignore"; # Don't suspend when on external power (docked setup) extraConfig = ''
HandlePowerKey = "suspend"; # Suspend on power button press HandlePowerKey=ignore
HandleSuspendKey = "suspend"; # Allow manual suspend from GNOME menu HandleSuspendKey=ignore
HandleHibernateKey = "ignore"; HandleHibernateKey=ignore
IdleAction = "ignore"; # No automatic idle suspend IdleAction=ignore
IdleActionSec = "0"; '';
};
}; };
# Thermal management # Thermal management
@ -215,21 +171,13 @@
# GPU monitoring # GPU monitoring
intel-gpu-tools intel-gpu-tools
# Laptop utilities
brightnessctl
# ThinkPad specific # ThinkPad specific
lm_sensors # Temperature monitoring lm_sensors # Temperature monitoring
smartmontools # Disk health monitoring (SMART) smartmontools # Disk health monitoring (SMART)
]; ];
# Laptop-specific services
services.acpid.enable = true; services.acpid.enable = true;
services.upower.enable = true;
# Apply XKB config to console (TTY) as well
console.useXkbConfig = true;
services.tailscale-custom.exitNode = true; services.tailscale-custom.exitNode = true;