Loading patched ACPI tables

Hello. I need help in knowing what options I can utilise to ensure a patch for the ACPI table done through grub-mkconfig is saved post-reboot. I need this in order to have my speakers working. It consists of an .aml file and a script - I’ve tested this on other distributions and it works fine.

(for reference);

It would be great if I could have any info on this topic. Thank you so much.

Could you try loading this module?

I don’t know much about grub, so it will surely not work. But running ACPI on boot via systemd should be fine right?

{ pkgs, config, lib, ... }:
let
  zenbook-acpi = pkgs.stdenv.mkDerivation rec {
    pname = "asus-zenbook-ux3402za-acpi-tables";
    version = "0.0.1";
    src = pkgs.fetchFromGitHub {
      owner = "thor2002ro";
      repo = "asus_zenbook_ux3402za";
      rev = "54cc1488e8dd2ffbf3dbffd390e42d9a4657a2de";
      sha256 = "sha256-o32kAz8z/AMsKfCmU0nHxhcerDudYqJduHhRCeZbVPQ=";
    };

    nativeBuildInputs = with pkgs; [
      acpica-tools
    ];

    buildPhase = ''
      cp -r Sound Work
      iasl -tc Work/ssdt-csc3551.dsl
    '';

    installPhase = ''
      mkdir -p $out/boot $out/etc/grub.d
      cp Work/ssdt-csc3551.aml $out/boot/ssdt-csc3551.aml
      cp Work/01_acpi $out/etc/grub.d/01_acpi
    '';
  };
in
{
  # Here we try to apply the ACPI tables in two different ways:

  # Blindly following instructions from the repo
  boot.loader.grub = {
    extraFiles."ssdt-csc3551.aml" = "${zenbook-acpi}/boot/ssdt-csc3551.aml";
    extraConfig = lib.readFile "${zenbook-acpi}/etc/grub.d/01_acpi";
  };

  # Using a less risky systemd service
  systemd.services.load-asus-zenbook-acpi-tables = {
    description = "Load Asus Zenbook ACPI tables";
    serviceConfig = {
      Type = "oneshot";
      ExecStart = "${pkgs.acpi}/bin/acpi ${zenbook-acpi}/boot/ssdt-csc3551.aml";
    };
    wantedBy = [ "default.target" ];
  };
}