Commit graph

4 commits

Author SHA1 Message Date
Jörg Thalheim 6741751801 nixos/facter: add networking configuration
This adds automatic network configuration based on detected hardware:

- networking/default.nix: Auto-configure DHCP on physical interfaces
  Detects Ethernet, WLAN, USB-Link, and generic network interfaces,
  automatically enabling DHCP on each. Excludes loopback and mainframe
  interfaces. Sets networking.useDHCP and per-interface useDHCP.

- networking/intel.nix: Intel WiFi firmware detection
  Auto-enables firmware for Intel 2200BG and 3945ABG wireless cards
  based on PCI vendor/device IDs.

- networking/initrd.nix: Network drivers in initrd
  Loads network controller drivers when boot.initrd.network.enable
  is set, enabling network boot scenarios.

Builds on PR #454847 (boot & storage).
Part of incremental upstreaming from nixos-facter-modules.
2025-10-24 12:50:34 +02:00
Jörg Thalheim cb883c36e3 nixos/facter: add boot and storage detection
This adds automatic kernel module detection for boot-critical hardware:

- disk.nix: Detects and loads kernel modules for storage controllers
  Auto-detects modules for: disk controllers, storage controllers,
  and FireWire controllers (for FireWire-attached disks).
  Modules are automatically added to boot.initrd.availableKernelModules.

- keyboard.nix: Detects USB controller drivers for keyboard support
  Ensures USB HID drivers are loaded in initrd for keyboard access
  during boot (critical for LUKS password entry, etc.).

Follow up to #454237.
Part of incremental upstreaming from nixos-facter-modules.
2025-10-23 12:47:17 +02:00
Jörg Thalheim ab49e37a02 nixos/facter: add core library and system detection
This adds foundational functionality for nixos-facter hardware detection:

- lib.nix: Internal helper functions for querying facter reports
  - hasCpu/hasAmdCpu/hasIntelCpu: CPU vendor detection
  - collectDrivers: Extract driver_modules from hardware entries
  - toZeroPaddedHex: Format USB device IDs (for fingerprint matching)

- system.nix: Auto-detect nixpkgs.hostPlatform from facter report
  Automatically sets the correct platform (x86_64-linux, aarch64-linux, etc.)
  based on the hardware report, reducing manual configuration.

This builds on the base infrastructure added in PR #450303 and provides
the foundation for upcoming hardware detection modules (boot, networking,
graphics, etc.).

Part of the incremental upstreaming effort from:
https://github.com/nix-community/nixos-facter-modules
2025-10-22 12:38:46 +02:00
Jörg Thalheim b7f40d25eb nixos/facter: add initial commit
This is the first step to upstream nixos-facter-modules into
nixpkgs/nixos:

https://github.com/numtide/nixos-facter-modules/

We tried to stick close to the semantics nixos-generate-config + some
extra features. We choose a new prefix for hardware.facter to live in so
that existing users of nixos-facter-modules can continue using it while
the upstreaming is in progress.

The reason for upstreaming is to make it easier to have nixos-facter as
choice for hardware detection as part of our normal NixOS installation workflow.
Hardware from my experience takes many hands since it is hard to test
without having access to a large variety of hardware.

We hope that with nixos-facter we can reduce the boiler code required in
the nixos-hardware project and provide better out-of-the-box support,
even if a model has not been explicitly added to nixos-hardware.
I.e. unlike ubuntu we don't have support for detecting required GPU
drivers. We believe that nixos-hardware will be still required for some
vendor specific quirks, but we could in future automatically select the
profiles based on reported SKU from facter.

For more details watch the 2024 NixCon talk: https://www.youtube.com/watch?v=3H3YUqibC6c
2025-10-14 10:32:18 +01:00