bitspire/deploy/nixos/hardware/batm3.nix
Padreug 7c1011d382 chore(nix): bump nixpkgs 24.05 → 24.11
Three breakages handled:

- hardware.opengl → hardware.graphics (renamed in 24.11). Touches
  upboard.nix, douro.nix, batm3.nix, live.nix.
- vaapiIntel dropped — legacy pre-Broadwell driver, removed in
  nixpkgs. UP Board (Cherry Trail) and OptiPlex 9030 (Haswell) both
  use intel-media-driver, which stays.
- vaapiVdpau renamed → libva-vdpau-driver.

system.stateVersion stays 24.05 — convention is to never bump after
install. Existing Sintra and fresh flashes keep the 24.05 state
semantics; that's correct.

All 8 nixosConfigurations (4 models × {live,installed}) evaluate
clean with zero deprecation warnings on 24.11.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-01 19:12:11 +02:00

141 lines
4 KiB
Nix

# BATM3 Hardware Configuration
# Dell OptiPlex 9030 AIO, Intel i7-4790S, Intel HD 4600
# Board replacement for GeneralBytes BATM3 (ARM Android → x86 NixOS)
{ config, lib, pkgs, ... }:
{
boot = {
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
timeout = 3;
};
initrd.availableKernelModules = [
"xhci_pci"
"ahci"
"usbhid"
"sd_mod"
];
kernelModules = [
"kvm-intel"
"usbtouchscreen"
];
kernelParams = [
"quiet"
"splash"
];
};
# Disk layout: GPT with ESP (sda1) + ext4 root (sda2)
fileSystems."/" = {
device = "/dev/disk/by-label/nixos";
fsType = "ext4";
};
fileSystems."/boot" = {
device = "/dev/disk/by-label/ESP";
fsType = "vfat";
};
hardware = {
graphics = {
enable = true;
extraPackages = with pkgs; [
intel-media-driver
libva-vdpau-driver
libvdpau-va-gl
];
};
enableRedistributableFirmware = true;
cpu.intel.updateMicrocode = true;
};
powerManagement = {
enable = true;
cpuFreqGovernor = "performance";
};
# Disable suspend/hibernate for kiosk
systemd.targets = {
sleep.enable = false;
suspend.enable = false;
hibernate.enable = false;
hybrid-sleep.enable = false;
};
# WiFi: read credentials from /var/lib/bitspire/wifi.conf (not in repo)
# Format: SSID=MyNetwork\nPSK=MyPassword
system.activationScripts.wifi-setup = ''
WIFI_CONF="/var/lib/bitspire/wifi.conf"
if [ -f "$WIFI_CONF" ]; then
SSID=$(grep '^SSID=' "$WIFI_CONF" | cut -d= -f2-)
PSK=$(grep '^PSK=' "$WIFI_CONF" | cut -d= -f2-)
if [ -n "$SSID" ] && [ -n "$PSK" ]; then
CONN_FILE="/etc/NetworkManager/system-connections/$SSID.nmconnection"
if [ ! -f "$CONN_FILE" ]; then
cat > "$CONN_FILE" << EOF
[connection]
id=$SSID
type=wifi
autoconnect=true
[wifi]
mode=infrastructure
ssid=$SSID
[wifi-security]
key-mgmt=wpa-psk
psk=$PSK
[ipv4]
method=auto
[ipv6]
method=auto
EOF
chmod 600 "$CONN_FILE"
echo "[WiFi] Created connection for $SSID"
fi
fi
fi
'';
# eGalax touchscreen (Dell 9030 AIO built-in panel)
# The eGalax HID descriptor confuses libinput (treats it as touchpad).
# Fix: unbind from usbhid at boot, bind to usbtouchscreen kernel module,
# then apply calibration matrix after X11 starts.
# Unbind eGalax from usbhid, bind to usbtouchscreen
services.udev.extraRules = lib.mkAfter ''
KERNEL=="ttyS[0-9]*", MODE="0666"
KERNEL=="ttyUSB[0-9]*", MODE="0666"
KERNEL=="ttyACM[0-9]*", MODE="0666"
SUBSYSTEM=="tty", ATTRS{serial}=="DDDLb103Y23", SYMLINK+="ttyF56", MODE="0666"
SUBSYSTEM=="tty", ATTRS{serial}=="A9YW78OC", SYMLINK+="ttyMEI", MODE="0666"
SUBSYSTEM=="tty", ATTRS{serial}=="A9ZF8ELY", SYMLINK+="ttyNFC", MODE="0666"
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="0eef", ATTRS{idProduct}=="0001", RUN+="${pkgs.bash}/bin/bash -c 'echo ''$kernel:1.0 > /sys/bus/usb/drivers/usbhid/unbind 2>/dev/null; echo 0eef 0001 > /sys/bus/usb/drivers/usbtouchscreen/new_id 2>/dev/null'"
'';
# Apply touchscreen calibration after X11 starts
# Matrix: swap X/Y axes, invert both, scale to active panel area (238-1853 x 197-1869)
systemd.services.egalax-calibrate = {
description = "Calibrate eGalax touchscreen";
after = [ "display-manager.service" ];
requires = [ "display-manager.service" ];
wantedBy = [ "graphical.target" ];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
User = "bitspire";
Environment = "DISPLAY=:0";
ExecStartPre = "${pkgs.coreutils}/bin/sleep 3";
ExecStart = "${pkgs.xorg.xinput}/bin/xinput set-prop 'eGalax Inc. USB TouchController' 'Coordinate Transformation Matrix' 0 -1.268 1.147 -1.224 0 1.118 0 0 1";
};
};
# WireGuard VPN address
networking.wireguard.interfaces.wg0.ips = [ "10.0.0.5/24" ];
}