mirror of
https://forge.katzen.cafe/schrottkatze/nix-configs.git
synced 2024-11-22 13:24:40 +01:00
34 lines
1.2 KiB
Nix
34 lines
1.2 KiB
Nix
{ pkgs, ... }:
|
|
let
|
|
in {
|
|
# from https://github.com/tpwrules/nixos-m1/blob/main/nix/m1-support/firmware/default.nix
|
|
nixpkgs.overlays = [ (self: super: {
|
|
linux-mbp = super.callPackage ./packages/linux-mbp { };
|
|
apple-bce = super.callPackage ./packages/apple-bce { kernel = self.linux-mbp; };
|
|
apple-ib-drv = super.callPackage ./packages/apple-ib-drv { kernel = self.linux-mbp; };
|
|
}) ];
|
|
|
|
hardware.firmware = [
|
|
(pkgs.stdenvNoCC.mkDerivation {
|
|
name = "firmware";
|
|
buildCommand = ''
|
|
mkdir -p $out/lib/firmware
|
|
FIRMWARE=`echo ${./.}/*firmware*.tar`
|
|
if [ -e "$FIRMWARE" ]; then
|
|
tar xf "$FIRMWARE" -C $out/lib/firmware
|
|
# move firmware for my specific device
|
|
mv $out/lib/firmware/C-4377__s-B3/* $out/lib/firmware
|
|
find $out/lib/firmware -depth -type d -empty -delete
|
|
else
|
|
# stop nixos infra from breaking when it doesn't have any firmware
|
|
touch $out/lib/firmware/.dummy
|
|
fi
|
|
'';
|
|
})
|
|
];
|
|
|
|
boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux-mbp;
|
|
boot.extraModulePackages = [ pkgs.apple-bce pkgs.apple-ib-drv ];
|
|
boot.initrd.kernelModules = [ "apple_bce" "apple-ibridge" "apple-ib-tb" ];
|
|
}
|