Description
Hi,
Im on a Macbook Pro 2017 14.2"
running nixos 25.05
There are a few hardware problems with this device that are specific to NixOS.
I had Fedora 41 running on it before which had these things working.
1. Keyboard
During Luks prompt the Integrated Keyboard doesn't work.
I was able to fix this by adding these modules to my boot.initrd.kernelModules
"intel_lpss_pci"
"spi_pxa2xx_platform"
"applespi"
2. Audio
Under Fedora I was able to Install this specific Patch set for the Audio Driver
https://github.com/davidjo/snd_hda_macbookpro
With that one all audio worked flawlessly on my Device.
This Patch set seems to patch multiple c files of the base snd cirrus driver (as far as I understand)
The Maintainer of that Patch set also seems to have zero knowledge about nix (like me who just switched) and thus is not directly compatible.
See:
- nixOS install davidjo/snd_hda_macbookpro#85
- No Audio! Macbook pro 14.1! Running Arch Linux davidjo/snd_hda_macbookpro#134 (comment)
But thanks to some posters in threadsthere I got it working with another patchset
(which ive mirroed to https://git.euph.dev/snoweuph/snd-hda-codec-cs8409)
and this specific nix file
{ stdenv, lib, fetchgit, linuxKernel, kernel ? linuxKernel.kernels.linux_5_15
, version ? "d8c9001418e6172099a0907f022534f152e29d71" }:
stdenv.mkDerivation {
inherit version;
name = "sna-hda-codec-cs8409-${version}-module-${kernel.modDirVersion}";
# Upstream: https://github.com/davidjo/snd_hda_macbookpro
src = fetchgit {
url = "https://git.euph.dev/snoweuph/snd-hda-codec-cs8409";
rev = version;
sha256 = "sha256-uwPz2d9tJP9Tp+j0lFFKy2Dn/sVSqV2MRLec469KU+E=";
};
hardeningDisable = [ "pic" ];
nativeBuildInputs = kernel.moduleBuildDependencies;
NIX_CFLAGS_COMPILE = [ "-g" "-Wall" "-Wno-unused-variable" "-Wno-unused-function" ];
makeFlags = kernel.makeFlags ++ [
"INSTALL_MOD_PATH=$(out)"
"KERNELRELEASE=${kernel.modDirVersion}"
"KERNEL_DIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
];
postPatch = ''
printf '
snd-hda-codec-cs8409-objs := patch_cs8409.o patch_cs8409-tables.o
obj-$(CONFIG_SND_HDA_CODEC_CS8409) += snd-hda-codec-cs8409.o
KBUILD_EXTRA_CFLAGS = "-DAPPLE_PINSENSE_FIXUP -DAPPLE_CODECS -DCONFIG_SND_HDA_RECONFIG=1"
KERNELRELEASE ?= $(shell uname -r)
KERNEL_DIR ?= /lib/modules/$(KERNELRELEASE)/build
PWD := $(shell pwd)
default:
make -C $(KERNEL_DIR) M=$(PWD) CFLAGS_MODULE=$(KBUILD_EXTRA_CFLAGS)
install:
make -C $(KERNEL_DIR) M=$(PWD) modules_install
' \
> Makefile
sed --in-place 's|<sound/cs42l42.h>|"${kernel.dev}/lib/modules/${kernel.modDirVersion}/source/include/sound/cs42l42.h"|' patch_cs8409.h
sed --in-place 's|hda_local.h|${kernel.dev}/lib/modules/${kernel.modDirVersion}/source/sound/pci/hda/hda_local.h|' patch_cs8409.h
sed --in-place 's|hda_jack.h|${kernel.dev}/lib/modules/${kernel.modDirVersion}/source/sound/pci/hda/hda_jack.h|' patch_cs8409.h
sed --in-place 's|hda_generic.h|${kernel.dev}/lib/modules/${kernel.modDirVersion}/source/sound/pci/hda/hda_generic.h|' patch_cs8409.h
sed --in-place 's|hda_auto_parser.h|${kernel.dev}/lib/modules/${kernel.modDirVersion}/source/sound/pci/hda/hda_auto_parser.h|' patch_cs8409.h
'';
meta = { platforms = lib.platforms.linux; };
}
conclusion
The Keyboard was easy to fix. getting the patchset to work was hard.
request
Maybe it would be possible to extend the hardware support, so that it does 1. and .2 automatically in the hardware nix file?
or could we at least get the patched driver version as a package that is installable?