Skip to content

Commit f459299

Browse files
nesteroffbrianmcgillion
authored andcommitted
Add new generic intel-laptop target
Signed-off-by: Yuri Nesterov <yuriy.nesterov@unikie.com>
1 parent 65a6e30 commit f459299

File tree

4 files changed

+100
-1
lines changed

4 files changed

+100
-1
lines changed

modules/hardware/common/devices.nix

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ let
4646
d.path;
4747

4848
# Shorthand substitutions
49-
nicPciDevices = config.ghaf.hardware.definition.network.pciDevices;
49+
nicPciDevices = lib.filter (
50+
d: d.path != "" || (d.vendorId != null && d.productId != null)
51+
) config.ghaf.hardware.definition.network.pciDevices;
5052
gpuPciDevices = config.ghaf.hardware.definition.gpu.pciDevices;
5153
sndPciDevices = config.ghaf.hardware.definition.audio.pciDevices;
5254
evdevDevices = config.ghaf.hardware.definition.input.misc.evdev;

modules/reference/hardware/flake-module.nix

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@
4545
}
4646
];
4747

48+
hardware-intel-laptop.imports = [
49+
inputs.self.nixosModules.hardware-x86_64-workstation
50+
{
51+
ghaf.hardware.definition = import ./intel-laptop/intel-laptop.nix;
52+
ghaf.hardware.usb.vhotplug.autoDetectPci = true;
53+
}
54+
];
55+
4856
hardware-lenovo-t14-amd-gen5.imports = [
4957
inputs.self.nixosModules.hardware-x86_64-workstation
5058
{
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# SPDX-FileCopyrightText: 2022-2026 TII (SSRC) and the Ghaf contributors
2+
# SPDX-License-Identifier: Apache-2.0
3+
{
4+
# System name
5+
name = "Intel Laptop";
6+
7+
# List of system SKUs covered by this configuration
8+
skus = [ ];
9+
10+
# Host configuration
11+
host = {
12+
kernelConfig.kernelParams = [
13+
"intel_iommu=on,sm_on"
14+
"iommu=pt"
15+
"acpi_backlight=vendor"
16+
"acpi_osi=linux"
17+
"module_blacklist=i915,xe,iwlwifi,snd_hda_intel,snd_sof_pci_intel_tgl,bluetooth,btusb,snd_pcm,mei_me,xesnd_hda_intel,snd_sof_pci_intel_lnl,spi_intel_pci,i801_smbus"
18+
];
19+
};
20+
21+
# Network devices for passthrough to netvm detected dynamically in vhotplug
22+
network.pciDevices = [
23+
{
24+
name = "wlp0s5f0";
25+
path = "";
26+
}
27+
];
28+
29+
# GPU devices generally don't handle hotplugging well
30+
# However, Intel integrated GPU usually has PCI address 0000:00:02.0, so we can keep it statically defined here
31+
gpu = {
32+
pciDevices = [
33+
{
34+
path = "0000:00:02.0";
35+
# Workaround: assign vfio-pci driver for all GPUs (PCI class 3)
36+
# vfio-pci.ids format is vendor:device[:subvendor[:subdevice[:class[:class_mask]]]]
37+
# This is required because different revisions of Intel graphics have different device IDs
38+
vendorId = "0:0";
39+
productId = "0:0:3:0";
40+
}
41+
];
42+
kernelConfig = {
43+
stage1.kernelModules = [
44+
"i915"
45+
"xe"
46+
];
47+
kernelParams = [
48+
"earlykms"
49+
];
50+
};
51+
};
52+
53+
# Audio device for passthrough to audiovm detected dynamically in vhotplug
54+
audio = {
55+
kernelConfig = {
56+
stage1.kernelModules = [ ];
57+
stage2.kernelModules = [
58+
"i2c_i801"
59+
"snd_hda_intel"
60+
"snd_sof_pci_intel_tgl"
61+
"spi_intel_pci"
62+
"snd_soc_avs"
63+
];
64+
kernelParams = [ ];
65+
};
66+
};
67+
}

targets/laptop/flake-module.nix

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,17 @@ let
9393
}
9494
]))
9595

96+
# Generic target for Intel laptops with integrated graphics
97+
(laptop-configuration "intel-laptop" "debug" (withCommonModules [
98+
self.nixosModules.hardware-intel-laptop
99+
{
100+
ghaf = {
101+
reference.profiles.mvp-user-trial.enable = true;
102+
partitioning.disko.enable = true;
103+
};
104+
}
105+
]))
106+
96107
(laptop-configuration "lenovo-t14-amd-gen5" "debug" (withCommonModules [
97108
self.nixosModules.hardware-lenovo-t14-amd-gen5
98109
{
@@ -250,6 +261,17 @@ let
250261
}
251262
]))
252263

264+
# Generic target for Intel laptops with integrated graphics
265+
(laptop-configuration "intel-laptop" "release" (withCommonModules [
266+
self.nixosModules.hardware-intel-laptop
267+
{
268+
ghaf = {
269+
reference.profiles.mvp-user-trial.enable = true;
270+
partitioning.disko.enable = true;
271+
};
272+
}
273+
]))
274+
253275
(laptop-configuration "lenovo-t14-amd-gen5" "release" (withCommonModules [
254276
self.nixosModules.hardware-lenovo-t14-amd-gen5
255277
{

0 commit comments

Comments
 (0)