I am finding myself wanting to experiment with some x86 hardware, and it requires me to make patches to the ACPI tables (SSDT) or replace what’s provided by the UEFI BIOS completely (DSDT).
https://docs.kernel.org/admin-guide/acpi/initrd_table_override.html
I have not yet found a ready-made way to do this in NixOS, so how would one go about this?
Thanks!
I have found a reliable way of doing this that is fairly clean and works well with rollbacks:
custom-dsdt.nix
{
stdenv,
acpica-tools,
cpio
}:
stdenv.mkDerivation {
name = "custom-dsdt";
src = ./.; # dsdt.dsl is stored here
phases = [ "unpackPhase" "installPhase" ];
nativeBuildInputs = [
acpica-tools
cpio
];
installPhase = ''
mkdir -p $out/
mkdir -p kernel/firmware/acpi
iasl -p ./dsdt -sa $src/dsdt.dsl
cp dsdt.aml kernel/firmware/acpi/DSDT.aml
find kernel | cpio -H newc --create > $out/dsdt.cpio
'';
}
configuration.nix
{ config, lib, pkgs, pkgs-unstable, ... }:
{
boot = {
kernelPatches = lib.singleton {
name = "allow-sdhci-acpi";
patch = null;
extraConfig = ''
ACPI_TABLE_UPGRADE y
'';
};
};
boot.initrd.prepend = [
"${(pkgs.callPackage ./custom-dsdt.nix {})}/dsdt.cpio"
];
1 Like