Commit Graph

21 Commits

Author SHA1 Message Date
zimward
2f236ee997 nixos/facter: enable amd-pstate for amd cpus 2026-04-21 19:21:31 +02:00
andre4ik3
5dd1dff815 nixos/facter: add enable option
The option defaults to `report != { }` instead of `reportPath != null`,
because since the report may be set externally using `report`, guarding
for `reportPath != null` breaks setups that set it externally, since
none of the modules take effect any longer.
2026-03-11 09:07:52 +00:00
Yureka
2141b99d9e tree-wide: use allowUnfreePackages where applicable 2026-01-27 13:10:24 +01:00
Jörg Thalheim
f45d3d9b0a docs/facter: add documentation for nixos-facter 2025-12-23 14:58:54 +00:00
r-vdp
3d836c9d72 nixos/facter: enable grub uefi support based on facter report
See fb9eea6bb0

Co-authored-by: Christian Friedow <christian@friedow.com>
2025-12-23 12:25:55 +02:00
Jörg Thalheim
7c087d58df nixos/facter: add debug utilities
This adds debugging tools for comparing system configurations with and
without facter-based hardware detection:

Example usage:
  nix-build '<nixpkgs/nixos>' -A config.hardware.facter.debug.nvd
  ./result/bin/facter-diff

Builds on PR #466808 (camera support).
Part of incremental upstreaming from nixos-facter-modules.
2025-12-21 11:15:02 +00:00
Jörg Thalheim
a7af30e32e nixos/facter: fix ipu6 kernel version warning condition
The suspension/shutdown regression affects kernel 6.16 and later, not
just 6.16 specifically. Use versionAtLeast instead of equality check.

Also fix issue reference (372 was a separate issue) and typo.
2025-12-17 16:36:48 +01:00
Jörg Thalheim
f1498c9c56 nixos/facter: fix collectDrivers returning nested lists
The collectDrivers function was using lib.catAttrs which extracts
attribute values into a list. Since driver_modules is already a list,
this resulted in nested lists like [["i915"]] instead of ["i915"],
causing boot.initrd.kernelModules to fail with:

  error: expected a string but found a list: [ "i915" ]

Restore the original foldl' implementation from nixos-facter-modules
that properly concatenates driver_modules lists into a flat result.

Add graphics_card and monitor entries to test data to catch this
regression.

Fixes: https://github.com/NixOS/nixpkgs/pull/466808#issuecomment-2749380083
2025-12-17 16:33:41 +01:00
Jörg Thalheim
cb6d7834c5 nixos/facter: add Intel IPU6 camera support
This adds automatic detection and configuration for Intel IPU6 cameras:

This is particularly useful for modern Intel laptops (11th-14th gen) with
integrated webcams that require the intel-ipu6 drivers. Auto-configuration
eliminates manual setup for these specialized devices.

Builds on PR #463457 (input peripherals).
Part of incremental upstreaming from nixos-facter-modules.
2025-12-01 14:01:19 +01:00
Jörg Thalheim
8b9171eed7 nixos/facter: add input peripheral detection
This adds automatic detection and configuration for input peripherals:

- bluetooth: Detects Bluetooth hardware and automatically enables
- fingerprint: Detects USB fingerprint devices using libfprint device database

Builds on PR #458177 (graphics).
Part of incremental upstreaming from nixos-facter-modules.
2025-12-01 13:48:46 +01:00
Jörg Thalheim
484feccb9f nixos/facter: handle case where we do not have readOnly included 2025-11-20 12:59:58 +01:00
Jörg Thalheim
a555914285 nixos/facter: make hasCPUFeature more fault-tolerant
Add default value for features attribute in hasCPUFeature function
to handle CPU records that might not have a features field, preventing
errors when the report structure varies.
2025-11-05 22:57:03 +01:00
Jörg Thalheim
3e758c612d nixos/facter: add reportPath guard to all modules
Add lib.mkIf condition checking if config.hardware.facter.reportPath != null
to all facter modules. This shortcuts the module effects when no facter
report is available, preventing unnecessary evaluation and potential errors
when the report is not provided.
2025-11-05 22:57:03 +01:00
Jörg Thalheim
79d683f4ad nixos/facter: add graphics hardware detection
This adds automatic graphics card configuration:

Builds on PR #456698 (virtualization & firmware).
Part of incremental upstreaming from nixos-facter-modules.
2025-11-04 19:27:19 +01:00
Jörg Thalheim
9c973022fc nixos/facter: fix conflict with readOnlyPkgs (#456076) 2025-11-04 18:14:46 +00:00
Jörg Thalheim
ddf53abd21 nixos/facter: add virtualization and firmware support
This adds automatic virtualization detection (virtualisation.nix) and firmware management (firmware.nix).

Builds on PR #455151 (networking).
Part of incremental upstreaming from nixos-facter-modules.
2025-11-03 14:45:19 +01:00
Reuben Ferabend
37f37f59b5 nixos/facter: fix conflict with readOnlyPkgs 2025-11-02 09:30:28 +13:00
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