tpwrules / nixos-apple-silicon

Resources to install NixOS bare metal on Apple Silicon Macs
MIT License
742 stars 73 forks source link

The firmware location appears incorrect. #172

Open ityspace opened 3 months ago

ityspace commented 3 months ago

When I use my flakes configurations, and add apple-silicon-support to configuration, it reports that Asahi perpheral firmware extraction is enabled but the firmware location appears incorrect.

heywoodlh commented 3 months ago

I ran into this whilst attempting to build my NixOS+Asahi Configuration while on a MacOS, so I dug into this. You can see the relevant bits here:

https://github.com/tpwrules/nixos-apple-silicon/blob/bdc68b494d6a26c9457f4841ab1a6109b12a33e6/apple-silicon-support/modules/peripheral-firmware/default.nix#L4-L11

https://github.com/tpwrules/nixos-apple-silicon/blob/bdc68b494d6a26c9457f4841ab1a6109b12a33e6/apple-silicon-support/modules/peripheral-firmware/default.nix#L48-L54

In essence, you have to have the peripheral firmware installed at the default locations of either /boot/asahi or /mnt/boot/asahi. If you have it at a different location, you should specify a different peripheralFirmwareDirectory or you could disable firmware extraction with extractPeripheralFirmware = false;. These directories should exist when installing Asahi Linux via this repo (or after).

In my case, it won't work because I'm building my NixOS configuration on a NixOS VM (the Nix-Darwin Linux builder) that doesn't have the /boot/asahi or /mnt/boot/asahi directory (this is fine for me as I was just testing my build).

Hope this information is helpful as I also wanted to understand why my test build was failing.

aspauldingcode commented 1 month ago

I'm having issues with this. I was able to rebuild by setting extractPeripheralFirmware = false; But, now I can't use internet, seems like other things are broken?

But I can't build if I turn it on.. and its definitely located at /boot/asahi/all_firmware.tar.gz...

Edit: I can rebuild if I pass --impure to the command..

Edit2: But I donnwaanna have to pass --impure.. I like pure

wahjava commented 1 month ago

You need to copy the firmware into your NixOS configuration repository as the README reads:

mkdir -p /mnt/etc/nixos/firmware && cp /mnt/boot/asahi/{all_firmware.tar.gz,kernelcache*} /mnt/etc/nixos/firmware

And then reference it in your NixOS configuration (and make sure firmware sub-directory is check-ed in to your NixOS configuration repository):

{
  # Specify path to peripheral firmware files.
  hardware.asahi.peripheralFirmwareDirectory = ./firmware;
}
aspauldingcode commented 1 month ago

You need to copy the firmware into your NixOS configuration repository as the README reads:


mkdir -p /mnt/etc/nixos/firmware && cp /mnt/boot/asahi/{all_firmware.tar.gz,kernelcache*} /mnt/etc/nixos/firmware

And then reference it in your NixOS configuration (and make sure firmware sub-directory is check-ed in to your NixOS configuration repository):


{

  # Specify path to peripheral firmware files.

  hardware.asahi.peripheralFirmwareDirectory = ./firmware;

}

I added that line, got a new error (yay, progress) but what’s going on with this? What’s preventing a rebuild here? https://paste.ee/p/XqAK2

wahjava commented 1 month ago

You need to copy the firmware into your NixOS configuration repository as the README reads:

mkdir -p /mnt/etc/nixos/firmware && cp /mnt/boot/asahi/{all_firmware.tar.gz,kernelcache*} /mnt/etc/nixos/firmware

And then reference it in your NixOS configuration (and make sure firmware sub-directory is check-ed in to your NixOS configuration repository):

{

  # Specify path to peripheral firmware files.

  hardware.asahi.peripheralFirmwareDirectory = ./firmware;

}

I added that line, got a new error (yay, progress) but what’s going on with this? What’s preventing a rebuild here? https://paste.ee/p/XqAK2

Did you commit the firmware subdirectory to your repository ?

aspauldingcode commented 1 month ago

Did you commit the firmware subdirectory to your repository ?

https://github.com/aspauldingcode/.dotfiles/tree/main/system/NIXY2/firmware

Think so?

wahjava commented 1 month ago

Sorry, at a glance, this seems like a problem with your flake inputs, and esp. processing flake-parts flake in here. Nothing to do with firmware as I mis-assumed.

aspauldingcode commented 1 month ago

Sorry, at a glance, this seems like a problem with your flake inputs, and esp. processing flake-parts flake in here. Nothing to do with firmware as I mis-assumed.

How do I fix it? All my other systems use that.. I'm not really sure what it is.