Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions ekaos/configurations/iso-generic.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Generic EkaOS installation ISO
#
# Build with:
# nix-build -A isoImage '<ekaos>' -I ekaos=./ekaos/configurations/iso-generic.nix
#
# Or directly:
# nix-build ekaos/configurations/iso-generic.nix
#
# The resulting ISO is at: result/iso/ekaos-generic-*.iso
{
system ? "x86_64-linux",
pkgs ? import ../../. { inherit system; },
}:
let
ekaos = import ../default.nix {
inherit system pkgs;
modules = [
../modules/installer/installation-cd-base.nix
../modules/installer/hardware-profile.nix
(
{ lib, ... }:
{
isoImage.edition = "generic";
isoImage.bootMenuLabel = "EkaOS Installer";

system.ekaos.version = "25.05";
boot.kernelPackages = pkgs.linux.pkgs;
}
)
];
};
in
ekaos.config.system.build.isoImage
7 changes: 3 additions & 4 deletions ekaos/lib/make-initrd.nix
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,12 @@ let
exec switch_root /mnt-root /init
'';

# Kernel modules directory — aggregateModules takes a list of module
# packages (kernel, out-of-tree drivers, etc.) and runs depmod.
modulesTree = pkgs.aggregateModules [ kernelPackages.kernel ];
# Kernel modules directory
modulesTree = "${kernelPackages.kernel}/lib/modules";

in

kernelPackages.kernel.makeInitrd {
pkgs.makeInitrd {
contents = [
{
object = bootStage1;
Expand Down
75 changes: 75 additions & 0 deletions ekaos/modules/hardware/facter/audio.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Auto-detect audio hardware and configure sound device support
{
lib,
config,
...
}:
let
facterLib = import ./lib.nix lib;
inherit (config.hardware.facter) report;
cfg = config.hardware.facter.detected.audio;
isBaremetal = config.hardware.facter.detected.virtualisation.none.enable;

soundDevices = report.hardware.sound or [ ];
driverModules = facterLib.collectDrivers soundDevices;

# Detect Intel SOF (Sound Open Firmware) audio by driver module names
hasSofDriver = builtins.any (
m: lib.hasPrefix "snd_sof" m || lib.hasPrefix "snd-sof" m
) driverModules;

# Detect Intel HDA audio
hasHdaDriver = builtins.any (
m: lib.hasPrefix "snd_hda" m || lib.hasPrefix "snd-hda" m
) driverModules;
in
{
options.hardware.facter.detected.audio = {
enable = lib.mkEnableOption "Facter audio hardware detection" // {
default = builtins.length soundDevices > 0;
defaultText = "hardware dependent";
};

kernelModules = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = lib.unique driverModules;
defaultText = "hardware dependent";
description = "Kernel modules for detected audio hardware.";
};

sof.enable = lib.mkEnableOption "Facter Intel SOF audio detection" // {
default = hasSofDriver;
defaultText = "hardware dependent";
};

hda.enable = lib.mkEnableOption "Facter Intel HDA audio detection" // {
default = hasHdaDriver;
defaultText = "hardware dependent";
};
};

config = lib.mkIf config.hardware.facter.enable (
lib.mkMerge [
# Load audio driver modules
(lib.mkIf cfg.enable {
boot.initrd.availableKernelModules = cfg.kernelModules;
})

# Intel SOF audio: load additional SOF-specific modules
(lib.mkIf (cfg.enable && cfg.sof.enable) {
boot.kernelModules = [
"snd_sof"
"snd_sof_pci"
"snd_sof_intel_hda_common"
];
})

# Intel HDA audio
(lib.mkIf (cfg.enable && cfg.hda.enable) {
boot.kernelModules = [
"snd_hda_intel"
];
})
]
);
}
123 changes: 123 additions & 0 deletions ekaos/modules/hardware/facter/camera.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# Auto-detect Intel IPU6/IPU7 camera hardware and configure platform
{
lib,
config,
...
}:
let
facterLib = import ./lib.nix lib;
inherit (config.hardware.facter) report;

# Vendor: Intel (0x8086 = 32902)
intelVendorId = 32902;

# Intel IPU6 PCI device IDs per CPU generation
tigerLakeId = 39449; # 0x9a19
alderLakeId = 18013; # 0x465d
raptorLakeId = 42845; # 0xa75d
meteorLakeId = 32025; # 0x7d19

allIpu6Ids = [
tigerLakeId
alderLakeId
raptorLakeId
meteorLakeId
];

# Intel IPU7 PCI device IDs
lunarLakeId = 25693; # 0x645d
arrowLakeId = 45149; # 0xb05d

allIpu7Ids = [
lunarLakeId
arrowLakeId
];

multimediaDevices = report.hardware.multimedia_controller or [ ];

# Find Intel multimedia devices
findIntelDevice =
ids:
lib.findFirst (
{
vendor ? { },
device ? { },
...
}:
(vendor.value or 0) == intelVendorId && builtins.elem (device.value or 0) ids
) null multimediaDevices;

# IPU6 detection
ipu6Device = findIntelDevice allIpu6Ids;
hasIpu6 = ipu6Device != null;
ipu6DeviceId = if hasIpu6 then (ipu6Device.device.value or 0) else 0;

detectedIpu6Platform =
if ipu6DeviceId == tigerLakeId then
"ipu6"
else if ipu6DeviceId == alderLakeId || ipu6DeviceId == raptorLakeId then
"ipu6ep"
else if ipu6DeviceId == meteorLakeId then
"ipu6epmtl"
else
"ipu6";

# IPU7 detection
ipu7Device = findIntelDevice allIpu7Ids;
hasIpu7 = ipu7Device != null;
ipu7DeviceId = if hasIpu7 then (ipu7Device.device.value or 0) else 0;

detectedIpu7Platform = if ipu7DeviceId == arrowLakeId then "ipu75xa" else "ipu7x";
in
{
options.hardware.facter.detected.camera = {
ipu6 = {
enable = lib.mkEnableOption "Facter Intel IPU6 camera detection" // {
default = hasIpu6;
defaultText = "hardware dependent";
};

platform = lib.mkOption {
type = lib.types.enum [
"ipu6"
"ipu6ep"
"ipu6epmtl"
];
default = detectedIpu6Platform;
defaultText = "hardware dependent";
description = "Auto-detected IPU6 platform variant based on CPU generation.";
};
};

ipu7 = {
enable = lib.mkEnableOption "Facter Intel IPU7 camera detection" // {
default = hasIpu7;
defaultText = "hardware dependent";
};

platform = lib.mkOption {
type = lib.types.enum [
"ipu7x"
"ipu75xa"
];
default = detectedIpu7Platform;
defaultText = "hardware dependent";
description = "Auto-detected IPU7 platform variant.";
};
};
};

config = lib.mkIf config.hardware.facter.enable (
lib.mkMerge [
(lib.mkIf config.hardware.facter.detected.camera.ipu6.enable {
hardware.ipu6.enable = lib.mkDefault true;
hardware.ipu6.platform = lib.mkDefault config.hardware.facter.detected.camera.ipu6.platform;
})

(lib.mkIf config.hardware.facter.detected.camera.ipu7.enable {
hardware.ipu7.enable = lib.mkDefault true;
hardware.ipu7.platform = lib.mkDefault config.hardware.facter.detected.camera.ipu7.platform;
})
]
);
}
10 changes: 10 additions & 0 deletions ekaos/modules/hardware/facter/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,30 @@
}:
{
imports = [
./audio.nix
./boot.nix
./bluetooth.nix
./bluetooth-stack.nix
./camera.nix
./cpu.nix
./disk.nix
./fingerprint.nix
./firmware.nix
./fwupd.nix
./gaming.nix
./gpu.nix
./graphics.nix
./keyboard.nix
./laptop.nix
./networking.nix
./nvidia.nix
./power.nix
./printing.nix
./scanner.nix
./system.nix
./thermal.nix
./thunderbolt.nix
./touchscreen.nix
./trackpoint.nix
./virtualisation.nix
];
Expand Down
48 changes: 48 additions & 0 deletions ekaos/modules/hardware/facter/fingerprint.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Auto-detect fingerprint readers and enable fprintd
{
lib,
config,
...
}:
let
inherit (config.hardware.facter) report;
isBaremetal = config.hardware.facter.detected.virtualisation.none.enable;

fingerprintDevices = report.hardware.fingerprint_reader or [ ];

# Known fingerprint reader USB vendor IDs
# Goodix (0x27c6=10182), Synaptics/WBDI (0x06cb=1739), Elan (0x04f3=1267),
# AuthenTec (0x147e=5246), Validity/Synaptics (0x138a=5002)
knownVendors = [
10182
1739
1267
5246
5002
];

hasFingerprint = builtins.length fingerprintDevices > 0;

# Check if detected device is from a known vendor (for confidence)
hasKnownDevice = builtins.any (
{
vendor ? { },
...
}:
builtins.elem (vendor.value or 0) knownVendors
) fingerprintDevices;
in
{
options.hardware.facter.detected.fingerprint.enable =
lib.mkEnableOption "Facter fingerprint reader detection"
// {
default = hasFingerprint && isBaremetal;
defaultText = "hardware dependent";
};

config =
lib.mkIf (config.hardware.facter.enable && config.hardware.facter.detected.fingerprint.enable)
{
services.fprintd.enable = lib.mkDefault true;
};
}
46 changes: 46 additions & 0 deletions ekaos/modules/hardware/facter/gaming.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Auto-detect gaming peripherals (gamepads, joysticks)
{
lib,
config,
...
}:
let
facterLib = import ./lib.nix lib;
inherit (config.hardware.facter) report;
isBaremetal = config.hardware.facter.detected.virtualisation.none.enable;

joystickDevices = report.hardware.joystick or [ ];
hasJoystick = builtins.length joystickDevices > 0;

driverModules = facterLib.collectDrivers joystickDevices;
in
{
options.hardware.facter.detected.gaming = {
enable = lib.mkEnableOption "Facter gaming peripheral detection" // {
default = hasJoystick && isBaremetal;
defaultText = "hardware dependent";
};

kernelModules = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = lib.unique driverModules;
defaultText = "hardware dependent";
description = "Kernel modules for detected gaming peripherals.";
};
};

config = lib.mkIf (config.hardware.facter.enable && config.hardware.facter.detected.gaming.enable) {
# Load detected gamepad/joystick driver modules
boot.kernelModules = config.hardware.facter.detected.gaming.kernelModules;

# Common gamepad kernel modules that may not be in the facter report
# but are needed for hot-plugged controllers
boot.initrd.availableKernelModules = [
"xpad" # Xbox controllers
"hid-sony" # PlayStation controllers
"hid-nintendo" # Nintendo controllers
];

# TODO(corepkgs): Port steam-hardware udev rules for controller support
};
}
5 changes: 2 additions & 3 deletions ekaos/modules/hardware/facter/gpu.nix
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,10 @@ in
boot.initrd.kernelModules = [ "i915" ];
})

# NVIDIA GPU: enable mesa side, kernel modesetting for Wayland/display
# Proprietary drivers still require user opt-in
# NVIDIA GPU: enable graphics stack
# Driver configuration is handled by hardware.nvidia (via facter/nvidia.nix)
(lib.mkIf cfg.nvidia.enable {
hardware.graphics.enable = lib.mkDefault true;
boot.kernelParams = [ "nvidia-drm.modeset=1" ];
})
]
);
Expand Down
Loading
Loading