GithubHelp home page GithubHelp logo

nixos-apple-silicon's Introduction

About

This repository contains package expressions and NixOS configuration modules which are intended to provide a useful and straightforward bare metal NixOS experience on Apple Silicon Macs. Once NixOS is installed and the Apple Silicon configuration module is added, the system can be configured and operated like any other NixOS system.

We aim to generally replicate the experience and software configuration/versions provided by the Asahi Linux reference distro, and we rely primarily on their hard work. Contributions to improve the NixOS experience and address specific issues are welcome, but configuration and versions which diverge significantly will not be accepted.

Please see the documentation and guide below to get started.

Documentation

Credits

This is mostly a restructuring of work many others have already done, and it wouldn't have been possible without them. Important parts of the NixOS on Apple Silicon experience include (but are not limited to):

The Nix derivations and documentation in this repository are licensed under the MIT license as included in the LICENSE file. Patches included in this repository, and the files that Nix builds, are covered by separate licenses.

nixos-apple-silicon's People

Contributors

bkchr avatar codewitchbella avatar dasj avatar enzime avatar flokli avatar fx-chun avatar inclyc avatar ionagorria avatar lesuisse avatar lucus16 avatar natsukagami avatar newam avatar nyxalexandra avatar oati avatar oliverbestmann avatar quentini avatar rowang077 avatar sdier avatar shayne avatar smaug123 avatar tpwrules avatar yu-re-ka avatar zhaofengli avatar zzywysm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nixos-apple-silicon's Issues

nvme drive isn't found in installer

Hi! Thanks for your work on this. I'm able to boot into the installer correctly, but once in, not able to see the nvme drive to install to. nvme0n1 doesn't exist in lsblk and any other commands I tried.

Am I doing something wrong?

Installer can't mount /dev/root on MBP M1

Hello, I'm facing the same exact problem as #17 .
After dd'ing the generated iso to the usb drive and successfully booting grub and the kernel, it prints:
mount: mounting /dev/root on /mnt-root/iso failed: No such file or directory
I tried unplugging and replugging the usb while in the interactive shell, and it's recognized as /dev/sda, but I can't mount and fdisk says:
Disk /dev/sda doesn't contain a valid partition table

EDIT: using the .iso from the releases worked fine, so it's either an issue with my build or the newer versions of the packages included in the latest build process

Document installation procedure on external SSD.

I'd like to give this project a shot, however my only Apple Silicon macbook belongs to my employer and I'd rather not resize the internal disk and install linux on it. I'd like to be able to just test out Linux installed on and booted from an external SSD. A few threads on the Asahi Linux subreddit alude to this being possible by installing the bootloader to the internal disk, booting off that and then having the actual linux filesystem on an external drive: https://old.reddit.com/r/AsahiLinux/comments/12eib3r/asahi_linux_external_ssd/

This is an acceptable compromise, but there appears to be no functional tooling to achieve this configuration out of the box, I think it would be interesting to work it here.

Pure nix regex parser for the kernel config

The kernel package currently depends on an IFD (import from derivation) to parse the kernel config file.

The file is simple enough that it should be easily doable using pure nix with filter, map, regex match, etc.

This should be upstreamed to nixpkgs if resolved.

`cryptsetup` missing?

I've generated an installer with the instructions on this repo, and then booted into U-Boot and then the image itself off a USB drive.

However, the installation media seems to be missing cryptsetup, so I can't mount (nor re-format) the existing partition on my device.

Can I somehow build an image that includes the additions from this repo and the default ISO installer tools?

Cachix for mesa?

Hi,

Thanks for your incredible work on this project!

Sorry if this has been explored elsewhere; I'm a flakes user looking at the options for enabling GPU support without losing purity. It seems like "rebuilding the world" is the most obvious approach.

Still relatively new to nix -- just wondering, would setting up a shared binary cache on Cachix alleviate the difficulties here? (I know there is even a GitHub Action, seems possible that the CI might even be able to do some of the work over time.)

Thanks again for your work, sorry if this kind of question would have been better posted elsewhere!

Improvement 1: Standardize package inclusion with an overlay

Motivations/context (here only, in first issue)

Gotta say it: as more of a NixOS end-user than hacker, I'm grateful for this repo. Thank you for making this possible!

You mentioned edge and GPU support being something you'd have to give some thought to.

I have done a lot of "spiking" to that end in my local repo and ended up with major modifications which I find beneficial, but throwing those at you at once would be presumptuous.

Instead, I invite you on a refactoring process step by step (hence the titled numbering). Each improvement builds on the prior and will have its own PR. If at any point I've lost you or you don't like the direction at least you will have everything to that point. Every commit is "tested" in two ways:

  1. nix-build '<m1-support>' -I m1-support=/home/me/Code/nixos/nixos-m1 -A installer-bootstrap
  2. nixos-rebuild build -I m1-support=/home/me/Code/nixos/nixos-m1 (where in my configuration.nix I have imports = [ ./hardware-configuration.nix <m1-support/nix/m1-support>];)

I hope this jogs nixos-m1 and m1-support domains adequately. Rebuilding these appears to be a no-op, which I think signifies safety--I'm not substantively changing things.

Introducing an asahi-overlay for both nixos-m1 and m1-support

Let's introduce an asahi-overlay which we can use in both nixos-m1 and m1-support. This will remove the repetition and "failure surface area" of invoking sibling packages ad hoc N times. Instead, let's have all m1-support packages be ambient members of config.hardware.asahi.pkgs. This way, referencing them is as easy as pkgs.asahi-fwextract. (Because of laziness, they remain override-able! Finally, I got that through my head this time.)

That's all these changes do.

Module option to enable speakers experimentally

Hi! First off, this project has been working awesome for me on my Macbook Air M1. However, I'm just dying to get the awesome speakers going, so this issue will be about potentially adding an option that enables the speakers.

Proposal

Add a module option of the format

hardware.asahi.pleaseBlowUpMySpeakers = true;

which will:

  1. Add the snd-soc-macaudio.please_blow_up_my_speakers=1 option into modprobe options,
  2. Install alsa-ucm-conf-asahi into the system, and
  3. Install asahi-audio into the system.

Problems

This may actually blow up a lot of people's speakers

Not much needs to be said about this. It's why the feature is gated behind an option that is aptly named.

It is worth noting that efforts in adding this option right now will likely make it far easier to support speakers once they are actually stable in Asahi, since it seems like some userspace solution is very likely going to be needed.

Installing alsa-ucm-conf-asahi

See #54 (comment).

Macbook Air M1 is actually not supported

Currently, asahi-audio doesn't yet support J313. Some attempt was made to get it to work (AsahiLinux/asahi-audio#6), but it is unclear whether this is the recommended method.

Install script

Are there any plans to create a single installer.sh like other asahi distros?

error: package u-boot is not available, refusing to evaluate

I'm on a MacBook Pro 14 with an M1 Pro.

I've followed the installation instructions using the latest iso from the releases page. At the point where I am running nixos-install, I get the following error:

error: Package uboot-apple_m1_defconfig-2023.04.asahi2-1 in /nix/store/hmm1q79xgziadmx7hymqcvv3ingn3b8z-nixos-23.11.20230605.7409488/nixos/pkgs/misc/uboot/default.nix:124 is not available on the requested hostPlatform:
        hostPlatform.config = "x86_64-unknown-linux-gnu"
        package.meta.platforms = [
          "aarch64-linux"
        ]
        package.meta.badPlatforms = [ ]
        , refusing to evaluate.

It further suggests that I enable nixpkgs.config.allowUnsupportedSystem, but doing so leaves me with another error: an x86_64-linux with features {} is required to build <networkmanager>, but I am a aarch64-linux with features {benchmark, big-parallel, gccarch-armv8-a, kvm, nixos-test}

I can't seem to find anything online about this particular problem, and I am not experienced enough with nixpkgs to understand if there's something I'm doing that's causing this or not.

question: is there ever a need to update the proprietary firmware during normal operation?

Aside from during initial installation and during recovery/rescue, do I need to be mindful of updates to the non-free/non-redistributable firmware? The docs say the only way to update this firmware is via the EFI partition and that it doesn't change unexpectedly. Is there any situation where I must/should update the firmware, e.g. after a macOS system upgrade?

For context, if it matters, I am using flakes and have the proprietary firmware stored in a private git repo and included as a flake input for setting the path to the hardware.asahi.peripheralFirmwareDirectory. So, if something changed, I would need to update the private repo manually.

I only ask for my own peace of mind so that I don't accidentally break something through ignorance. If this is not a silly question, perhaps the answer could be added as a note in the docs?

Flake-based configurations must be built in impure mode when using experimental GPU support

Flake-based configurations must be built in impure mode when using experimental GPU support. This is due to the usage of system.replaceRuntimeDependencies to use Asahi's version of Mesa so that all programs work correctly.

I am exploring whether the recent Mesa upgrade in nixpkgs is enough to resolve the underlying issue and allow the removal of this replacement. If not, an extra configuration option will be added to properly overlay Asahi Mesa, though a large number of rebuilds will be required for flake users.

In the meantime, the best option is to use the --impure flag of nixos-rebuild if experimental GPU support is desired.

Improvement 2: Distinguish uniformly between packages and modules

Contingent on #34. Visit it for an overview of what's going on.

Next up: Standardize package contents by separating modules from packages

Let's abide by the convention of default.nix being an artifact with some specific utility. Configuration--the world of "modules"--is generic and written as modules which use packages. Basically this PR injects a distinction between the two and imposes it across all our m1-support packages uniformly. Each commit was tested as explained in #34.

release 2022-07-18 kernel patch fails

Building with 2022-07-18 changes results in build failure. Was the release kernel built on the same sha in the kernel package.nix? Looks like the Sven 4k patch no longer lines up.

patching script interpreter paths in scripts/ld-version.sh
scripts/ld-version.sh: interpreter directive changed from "#!/bin/sh" to "/nix/store/191yw2v0ys0qx3l8wlq5mh6ck968naf2-bash-5.1-p16/bin/sh"
applying patch /nix/store/54dzq4f942069fgckvhvcjwapcpcxha6-sven-iommu-4k.patch
patching file drivers/iommu/apple-dart.c
Hunk #1 succeeded at 196 (offset 99 lines).
Hunk #2 succeeded at 215 with fuzz 2 (offset 101 lines).
Hunk #3 succeeded at 663 (offset 166 lines).
Hunk #4 succeeded at 791 (offset 166 lines).
Hunk #5 succeeded at 895 (offset 166 lines).
Hunk #6 FAILED at 898.
Hunk #7 FAILED at 922.
2 out of 7 hunks FAILED -- saving rejects to file drivers/iommu/apple-dart.c.rej
patching file drivers/iommu/dma-iommu.c
Hunk #1 FAILED at 20.
Hunk #2 succeeded at 721 (offset 11 lines).
Hunk #3 succeeded at 763 (offset 11 lines).
Hunk #4 FAILED at 799.
Hunk #5 succeeded at 834 (offset 12 lines).
Hunk #6 FAILED at 842.
Hunk #7 succeeded at 1086 (offset 17 lines).
Hunk #8 succeeded at 1129 (offset 17 lines).
Hunk #9 succeeded at 1217 (offset 17 lines).
Hunk #10 succeeded at 1464 (offset 17 lines).
3 out of 10 hunks FAILED -- saving rejects to file drivers/iommu/dma-iommu.c.rej
patching file drivers/iommu/iommu.c
Hunk #1 succeeded at 81 with fuzz 1 (offset 1 line).
Hunk #2 succeeded at 1960 with fuzz 2 (offset -18 lines).
Hunk #3 succeeded at 1987 (offset -18 lines).
patching file drivers/iommu/iova.c
patching file include/linux/iommu.h
Hunk #3 succeeded at 106 with fuzz 2.

Booting the installer phase is stuck at "is now current device"

Hi,

I am trying to install NixOS.

I downloaded this ISO and used this command to prime the USB stick (on macOS):

sudo dd if=nixos-23.11.20230623.3ae20aa-apple-silicon-release-2023-06-25.iso of=/dev/disk2s1 bs=1m

Here is what I get when I try to boot:

U-Boot 2023.04 (Jun 06 2023 - 07:24:12 +0000)

Model: Apple MacBook Pro (14-inch, M1 Max, 2021)
starting USB..
Bus usbe702280000: Register 200047f NbrPorts 2
Starting the controller
USB XHCI 1.10
Bus usbeb02280000: Register 200047f NbrPorts 2
Starting the controller
USB XHCI 1.10
Bus usbef02280000: Register 200047f NbrPorts 2
Starting the controller
USB XHCI 1.10
scanning bus usb@702280000 for devices... 2 USB Device(s) found 
scanning bus usbeb02280000 for devices.   1 USB Device(s) found
scanning bus usbef02280000 for devices.   1 USB Device(s) found
scanning usb for storage devices.
Hit any key to stop autoboot: 0
1 Storage Device(s) found
Device 0: Vendor: Apple Reu: 874.120. Prod: Oba0161141894e21
	Type: Hard Disk
	Capacity: 954204.1 MB = 931.8 GB (244276265 ร— 4096)
... is now current device
Scanning nvme 0:4...
Failed to load '/'
Loading Boot0000 nvme 0:4 failed
EFI boot manager: Cannot load any image
Device 0: Vendor: USB Reu: 1.00 Prod: SanDisk 3.2Gen1
	Type: Removable Hard Disk
	Capacity: 58674.0 MB = 57.2 GB (120164352 ร— 512)
... is now current device
=โ€บ

From what I gathered here, GRUB should starts.

Everything stays put at the =>.

The exact same thing happens if I press a key to interrupt autoboot and type env set boot_efi_bootmgr ; run bootcmd_usb0.

I tried with two different keys.

What am I missing? ๐Ÿ˜ฌ

`nixos-install` crashes and results in boot looping

First of all, thanks so much for this project. It's wonderful!

I had a system up and running on an m1 mini but something went wrong resulting in bootloops and needing to reset the device with Apple Configurator. I've since updated to the latest build and have been trying to reinstall but every time I run nixos-install, the machine freezes and reboots. After the initial attempt, it seems that subsequent attempts fail earlier and eventually lead to the installer freezing and rebooting without any additional action.

I'm curious to know if you've encountered similar issues or have any idea where to start debugging this issue? The only explanation I can think of is that somewhere in the installer, the firmware bundle gets corrupted.

I will say, I've built the installer in a bit of a strange way on macOS. So perhaps that's the issue? I would expect that I would not be able to get to nixos-install if that was the problem though. I made use of the darwin.builder module in nixpkgs which runs a aarch64-linux vm in qemu to run linux builds on macOS. I just had to run the build commands as nix build .#packages.aarch64-linux.installer-bootstrap -o installer instead of nix build .#installer-bootstrap.

Because the reboots happen unpredicably and on the installer, I haven't been able to pull logs just yet. I'll see if I can enable SSH in the installer and then capture logs as it's running. Other than that I would really appreciate any guidance on where to look for potential issues.

Advice NixOS version

Hello,

My advise don't use NixOS version 23.05 at this moment, but 22.11.

I notice that many things are still not running smoothly on version 23.05 to unstable, using your own software in combination with the nixpkgs system, you sometimes get very strange errors, as one of the examples.

Back to version 22.11 no problem at all and everything runs as it should.

Build fails with rust 1.64.0 (from the current stable channel 22.11)

I'm trying to upgrade to the latest nixos-apple-silicon release (my system is on channel nixos-22.11). Kernel builds now fail for me, even though the kernel version has not changed (I've been running asahi-6.1-2 since December). The errors are:

error: attributes starting with `rustc` are reserved for use by the `rustc` compiler
  --> ../rust/alloc/alloc.rs:33:7
   |
33 |     #[rustc_nounwind]
   |       ^^^^^^^^^^^^^^

I see that there are now some preConfigure sed commands that are mucking with these attributes for rust 1.66.x. Nixos-22.11 is still on 1.64.x though. Removing the preConfigure changes fixes the build for me:

diff --git a/apple-silicon-support/packages/linux-asahi/default.nix b/apple-silicon-support/packages/linux-asahi/default.nix
index 4f00f3b..1c8a4d8 100644
--- a/apple-silicon-support/packages/linux-asahi/default.nix
+++ b/apple-silicon-support/packages/linux-asahi/default.nix
@@ -100,19 +100,7 @@ let
         '')
       ];
       RUST_LIB_SRC = rustPlatform.rustLibSrc;
-
-      preConfigure = ''
-        # Fixes for Rust 1.66.x
-        sed -i -e 's/rustc_allocator_nounwind/rustc_nounwind/g' rust/alloc/alloc.rs
-        sed -i -e 's/const Unpin/Unpin/' rust/alloc/boxed.rs
-        sed -i -e '/^pub unsafe trait RawDeviceId/i #[const_trait]' rust/kernel/driver.rs
-
-        # Fixes for rust-bindgen 0.63.0
-        sed -i -e 's/blacklist/blocklist/g' rust/Makefile
-        sed -i -e 's/whitelist/allowlist/g' rust/Makefile
-      '';
     } else {});
 
   linux-asahi = (callPackage linux-asahi-pkg { });
 in lib.recurseIntoAttrs (linuxPackagesFor linux-asahi)

Audio/headphones support

Hi, I'd love to get audio and headphones working on nixos-apple-silicon, but I'm not quite sure how. From what I understand it should be a matter of adding the asahi ucm configuration to the alsa-ucm-conf package but it still doesn't quite work

Heres my current attempt with an overlay in my config, where inputs.asahi-alsa-src points to [asahi's configuration(https://github.com/AsahiLinux/alsa-ucm-conf-asahi)

alsa-ucm-conf = prev.alsa-ucm-conf.overrideAttrs (old: rec {
  installPhase = ''
    runHook preInstall
    mkdir -p $out/share/alsa
    cp -r ucm ucm2 $out/share/alsa
    cp -r ${inputs.asahi-alsa-src}/ucm2/conf.d/macaudio $out/share/alsa/ucm2/conf.d/macaudio
    runHook postInstall
  '';
});

Build fails after upgrading nixpkgs unstable channel past 32aa10f0972

After updating the nixpkgs (unstable) channel, building uboot started to fail:

error: builder for '/nix/store/msjicb8q80namdk5nr2a336dm5ayb6yb-lzip-aarch64-unknown-linux-gnu-1.23.drv' failed with exit code 2
error: 6 dependencies of derivation '/nix/store/fj8331h736lfk36fz43l6san1qqbn7na-gnutls-aarch64-unknown-linux-gnu-3.7.6.drv' failed to build
error: 3 dependencies of derivation '/nix/store/7lf1sf3lsyhpn79x0zkhsix455xprdbw-uboot-apple_m1_defconfig-aarch64-unknown-linux-gnu-2022.07_rc100.asahi3.drv' failed to build
error: 1 dependencies of derivation '/nix/store/k80xg84vcmb0q151yf7ywqqhbpdmbpim-boot.bin.drv' failed to build
error: 1 dependencies of derivation '/nix/store/fjhfvamfixpbd2xylq8p687saklv165n-grub-config.xml.drv' failed to build
error: 1 dependencies of derivation '/nix/store/1i6xjvi88rk6pnd6lagzwlqv49zcy35r-install-grub.sh.drv' failed to build

I bisected nixpkgs down to this commit: ubootTools: Fix after update of uboot to 2022.07
.

Overriding buildInputs to be empty fixes it for me: buildInputs = [ ]; Not sure if that is the "correct" solution though.

Can't get Bluetooth to work

I'm running a 2020 M1 MacBook Air, but am having trouble getting bluetooth.service to start with the latest kernel that was pushed here. I don't think Bluetooth is loading at all (/sys/class/bluetooth is missing), and I'm not quite sure why - I'd assume firmware isn't the issue as WiFi is working fine. I didn't spot any issues about Bluetooth, is this something that requires further work to support in NixOS, or have I just messed something up? Happy to provide logs if they're of any use.

Kernel missing some capabilities

Trying to use wifi with iwd, turns out some options are missing in the kernel:

CONFIG_CRYPTO_USER_API_SKCIPHER
CONFIG_KEY_DH_OPERATIONS
CONFIG_CRYPTO_ECB
CONFIG_CRYPTO_CBC
CONFIG_CRYPTO_DES
CONFIG_CRYPTO_AES

Turning them on would be quick fix, but I think it would make sense to try and base the config on the upstream Nix config, and only override the values specifically needed for running on the M1. Otherwise there will always be more small differences that will break things in unexpected ways. This approach should also reduce the burden of eventually up-streaming the work done here.

The problem is, right now, it's not very clear which flags must change for M1. I'm going to try and diff the asahi kernel config with the defaults and see if the diff is rather small or not.

Erro building m1n1

Hi,

great work with packaging all this together.

Unfortunately for me building m1n1 doesn't work, i am getting this:

ecking if the linker (/private/tmp/nix-build-aarch64-unknown-linux-gnu-stage-final-gcc-debug-11.2.0.drv-0/build/./gcc/collect-ld) is GNU ld... (cached) yes
checking for shared libgcc... yes
configure: versioning on shared library symbols is gnu
configure: updating cache ./config.cache
checking for CET support... no
checking that generated files are newer than configure... done
configure: error: conditional "ENABLE_DARWIN_AT_RPATH" was never defined.
Usually this means the macro was only invoked conditionally.
make[1]: *** [Makefile:16550: configure-target-libatomic] Error 1
checking that generated files are newer than configure... done
configure: error: conditional "ENABLE_DARWIN_AT_RPATH" was never defined.
Usually this means the macro was only invoked conditionally.
make[1]: *** [Makefile:15634: configure-target-libgomp] Error 1
make[1]: Leaving directory '/private/tmp/nix-build-aarch64-unknown-linux-gnu-stage-final-gcc-debug-11.2.0.drv-0/build'
make: *** [Makefile:974: all] Error 2
error: builder for '/nix/store/m0fhn8c51q9qjshi7y9m56yl3pif91d1-aarch64-unknown-linux-gnu-stage-final-gcc-debug-11.2.0.drv' failed with exit code 2;
       last 10 log lines:
       > checking that generated files are newer than configure... done
       > configure: error: conditional "ENABLE_DARWIN_AT_RPATH" was never defined.
       > Usually this means the macro was only invoked conditionally.
       > make[1]: *** [Makefile:16550: configure-target-libatomic] Error 1
       > checking that generated files are newer than configure... done
       > configure: error: conditional "ENABLE_DARWIN_AT_RPATH" was never defined.
       > Usually this means the macro was only invoked conditionally.
       > make[1]: *** [Makefile:15634: configure-target-libgomp] Error 1
       > make[1]: Leaving directory '/private/tmp/nix-build-aarch64-unknown-linux-gnu-stage-final-gcc-debug-11.2.0.drv-0/build'
       > make: *** [Makefile:974: all] Error 2
       For full logs, run 'nix log /nix/store/m0fhn8c51q9qjshi7y9m56yl3pif91d1-aarch64-unknown-linux-gnu-stage-final-gcc-debug-11.2.0.drv'.
error: 1 dependencies of derivation '/nix/store/0y5qy1pn3lm4xbgq15002vh3dgqk114y-aarch64-unknown-linux-gnu-stage-final-gcc-debug-wrapper-11.2.0.drv' failed to build
error: 1 dependencies of derivation '/nix/store/rgjwzj4kb6w722ld004x6i89a3wqvryz-m1n1-unstable-2022-03-27.drv' failed to build 

NixOS installer can't find /dev/root during Stage 1

Everything worked fine up until this point.

Additionally, I couldn't successfully build the ISO locally (it errored; I also tried with --pure, same error), so I had to download one of the releases.

The output looks like this (note that this is a text copy from a photo I took on my iPhone, so character recognition errors may exist):

<<< NixOS Stage 1 >>> 

loading module loop...
loading module overlay...
loading module dm_mod...
running udev...
Starting version 251.3
starting device mapper and LVM...
mounting tmpfs on /...
waiting for device /dev/root to appear........................
Timed out waiting for device /dev/root, trying to mount anyway.
mounting /dev/root on /iso...
[   24.286920] /dev/root: Can't open blockdev
[   24.287235] /dev/root: Can't open blockdev
[   24.287527] /dev/root: Can't open blockdev
[   24.287841] /dev/root: Can't open blockdev
[   24.288213] /dev/root: Can't open blockdev
mount: mounting /dev/root on /mnt-root/iso failed: No such file or directory

An error occurred in stage 1 of the boot process, which must mount the
root filesystem on '/mnt-root' and then start stage 2. Press one
of the following keys:

   i) to launch an interactive shell
   f) to start an interactive shell having pid 1 (needed if you want to start stage 2's init manually)
   r) to reboot immediately
   *) to ignore the error and continue

Installer fails to load

Hi,
I'm having some trouble trying to get U-Boot to boot the installer ISO I flashed to my thumb drive. When the USB drive containing the installer is plugged in, my MacBook powers off after the U-Boot screen and boots back into U-Boot, resulting in a boot loop. When the USB drive is not plugged in, U-Boot just complains that there's no drive to boot from (obviously).

Hardware: 2022 MacBook Air w/ M2 SoC

Things I've tried so far:

  • dd the ISO to the USB drive from both Linux and macOS
  • used an older ISO from the GitHub releases

I do realize that it's hard to pinpoint any issue from the little information I've given, but maybe you could help me gather some more debug output :) Thanks anyway for the work you're putting into this project!

boot.initrd.systemd.enable broken with asahi kernel config

I wanted to set boot.initrd.systemd.enable = true to enable unlocking my luks2 root volume with a fido2 key.

boot.initrd.systemd adds a couple of kernel modules to initrd.availableKernelModules including tpm-tis and tpm-crb: https://github.com/nixos/nixpkgs/blob/a59124d7d492bb319cecd7ed26c5a4c29154ccb3/nixos/modules/system/boot/systemd/initrd.nix#L343-L348

Neither of those modules are currently complied with the apple-silicon kernel so this failed.

It would be nice to add these modules so this works out of the box.

I worked around this issue by setting the following in my kernel extraConfig:

          ACPI y
          TCG_TPM y
          TCG_TIS m
          TCG_CRB m

KDE + Wayland + experimental GPU driver

Hey did someone get this configuration working?

Using X11 with the experimental GPU driver works, but wayland fails. It starts, but hangs and I couldn't yet find any indication on what is wrong. I tried to remove almost everything from my config and to only add KDE, but it didn't helped.

Boot process regularly hangs at "starting systemd-udevd version..."

My M2 MBA often fails to boot with the new GPU driver (not sure if it's actually related to the GPU driver, but this was the major update that introduced the issue). The boot process hangs at "starting systemd-udevd version..." and after a couple of seconds, the system reboots. Sometimes this bootloop continues for 3-4 iterations, and some other times the issue does not occur at all. I believe that fiddling around in systemd-boot to delay the boot process prevents the issue somewhat reliably, so there may a hardware initialization race condition causing this problem.

mesa 23.0.1 blocks loading of drivers built with different version

  hardware.asahi.experimentalGPUInstallMode = "driver";
  hardware.asahi.useExperimentalGPUDriver = true;
  hardware.asahi.addEdgeKernelConfig = true;
00:00:00.009 [ERROR] [wlr] [EGL] command: eglQueryDeviceStringEXT, error: EGL_BAD_PARAMETER (0x300c), message: "eglQueryDeviceStringEXT"
00:00:00.009 [ERROR] [wlr] [EGL] command: eglQueryDeviceStringEXT, error: EGL_BAD_PARAMETER (0x300c), message: "eglQueryDeviceStringEXT"
DRI driver not from this Mesa build ('23.1.0-devel' vs '23.0.1')
failed to bind extensions
MESA-LOADER: failed to open zink: /run/opengl-driver/lib/dri/zink_dri.so: cannot open shared object file: No such file or directory (search paths /run/opengl-driver/lib
/dri, suffix _dri)
DRI driver not from this Mesa build ('23.1.0-devel' vs '23.0.1')
failed to bind extensions
DRI driver not from this Mesa build ('23.1.0-devel' vs '23.0.1')
failed to bind extensions
00:00:00.020 [ERROR] [wlr] [render/egl.c:538] Failed to create GBM device
00:00:00.020 [ERROR] [wlr] [render/egl.c:554] Failed to initialize EGL context
00:00:00.020 [ERROR] [wlr] [render/gles2/renderer.c:679] Could not initialize EGL

In this case we should probably package multiple versions that are rebased on top of the corresponding mesa version

Update asahi-fwextract

There have been multiple releases of asahi-fwextract since the 0.5pre2 version you currently use. Assuming the newer versions are not incompatible, it's probably time to switch to the latest (and double-check your patch still applies cleanly).

Improvement 4: Source and configure some "asahi-overlay" packages from Asahi's PKGBUILDs

Contingent on #37. See any prior issues for more context. It's a sequence.

Perform limited processing of PKGBUILDs contents to prepare for edge kernel and GPU support

I've actually already done most of this work. (Not on github just yet.)

Let's use PKGBUILDs as the source of truth for which version of asahi tools we're building from. We pick one digest (say stable branch) and whether we're stable or edge kernel, build a corresponding kernel config, mesa configuration, etc... and they should all play well with each other. This is also where GPU support becomes configurable.

I already have stable GPU support running off this approach. :)

Trying out a new version of asahi should be synonymous with "updating the PKGBUILDs pin." Sometimes a bit more for hand tweaks, but generally just that.

I am reapplying my working changes to this new, more disciplined refactor. It shouldn't be more than a day or two.

I hope slogging through my sequence of improvements was worth it. This was the point.

Xorg with Nixos on an M1 macbook air seems to be very sluggish.

I wrote up a basic home-manager + nix flake config for my m1 mac, and i'm using the same awesomewm config as what i used on regular asahi alarm. however, awesome on Nixos is noticeably slower, with workspace switching taking upwards of 1 second and the CPU usage of X spiking up to 50% every time a window is opened. Programs that used to work perfectly in asahi alarm, such as alacritty, now cant seem to use the graphics driver as they run very slowly. I have opengl and the edge kernel enabled, the relevant part of the config here

I would really appreciate if someone could tell me exactly what I'm doing wrong,

rust related errors building installer

Using the steps in https://github.com/tpwrules/nixos-apple-silicon/blob/main/docs/uefi-standalone.md#software-preparation I get no errors building m1n1 or uboot-asahi but when I get to installer-bootstrap I see many errors like the following

linux-aarch64-unknown-linux-gnu> /nix/store/51sszqz1d9kpx480scb1vllc00kxlx79-bash-5.2-p15/bin/bash: line 1: rustc: command not found
linux-aarch64-unknown-linux-gnu> expr: syntax error: unexpected argument '1.69.0'

after this the build "succeeds" and an .iso is produced but I'm suspicious about its correctness. Are these errors new from upstream changes? Existing and expected?

Thank you!

Trackpad not working

Thanks for this config!

Things are working for me except trackpad movements are not being detected. Trackpad clicks do seem to work though. I had previously installed Asahi+Arch and the trackpad worked correctly there.

This is with a new m2 air. It sounds like there were some changes for the M2 trackpad: https://asahilinux.org/2022/07/july-2022-release/ is there something that needs to be updated to get the trackpad working?

m1n1 does not compile on x86_64-linux

error: builder for '/nix/store/zp848wi09j27f9z62a863ypf3sj32j2n-m1n1-1.2.9.drv' failed with exit code 2;
       last 10 log lines:
       > updateAutotoolsGnuConfigScriptsPhase
       > configuring
       > no configure script, doing nothing
       > building
       > build flags: SHELL=/nix/store/p6dlr3skfhxpyphipg2bqnj52999banh-bash-5.2-p15/bin/bash ARCH=
       >   TAG   build/build_tag.h
       >   CFG   build/build_cfg.h
       >   CC    build/adt.o
       > gcc: error: unrecognized command-line option '-mstrict-align'; did you mean '-Wstrict-aliasing'?
       > make: *** [Makefile:183: build/adt.o] Error 1
       For full logs, run 'nix log /nix/store/zp848wi09j27f9z62a863ypf3sj32j2n-m1n1-1.2.9.drv'.

Gpu not working on Wayland + Sway + NixOS

Hello! thank you for the amazing project

I've been trying to get Asahi working with nix on my M1 machine, everything boots and runs just fine but graphical acceleration doesn't seem to be working

I've added nixos-m1 as a flake input
https://github.com/shaunsingh/nix-darwin-dotfiles/blob/2c6eb06679dfbbe87d96f11f7546c2c42923df8a/flake.nix#L19-L22

and I import it from the flake here, as well as enable GPU support and the edge kernel
https://github.com/shaunsingh/nix-darwin-dotfiles/blob/2c6eb06679dfbbe87d96f11f7546c2c42923df8a/modules/linux.nix#L9-L17

However, when I launch any application (Firefox, etc.) it gives a message that no GPU was found, and glxinfo fails to run as well. Any ideas?

Sway is built from source from git, and the firmware is from today itself

Link to full dotfiles: https://github.com/shaunsingh/nix-darwin-dotfiles/blob/main/flake.nix

How do I build the edge kernel?

I have no idea on how to swap out mesa, enable rust support and add the config flags. Could someone please help outline how one would do that? Many thanks in advance.

How to avoid --impure with flakes?

I have been using the flake distro for a few weeks and consider it fantastic. However I do not know how to avoid using --impure when building the system.

I get the following error when --impure is not passed:

error: cannot look up '<nixos-config>' in pure evaluation mode (use '--impure' to override)

       at /nix/store/ld9ihawdpciw50x3h0kzjzk4c8vy0vkb-source/nixos/modules/system/activation/top-level.nix:317:68:

          316|         config.system.copySystemConfiguration
          317|         ''ln -s '${import ../../../lib/from-env.nix "NIXOS_CONFIG" <nixos-config>}' \
             |                                                                    ^
          318|             "$out/configuration.nix"
(use '--show-trace' to show detailed location information)

Improvement 3: Reorganize into two code groups: "modules" and "asahi-overlay" (packages)

Contingent on #36, which is itself contingent on #34. See 'Improvement 1' for motivations and context for this sequence

Reorganize into two code groups: modules and asahi-overlay

Let's create two directories modules and asahi-overlay and move everything to its proper location. No changes other than references and file locations are allowed. All commits were tested as specified in #34. This concludes code reorganization for now.

`kvm` support?

Hi, thanks for creating this project! I'm pretty dissatisfied with the price/performance of dedicated aarch64 hardware compared to Apple Silicon, so I'm considering using one of our low-end M1 Macs to replace an aarch64-linux machine running NixOS.

What's the status of kvm support in M1 NixOS (as in nix.settings.system-features = [ "kvm" ...])? I'd like to be able to run NixOS tests and nixpkgs builders like pkgs.vmTools.runInLinuxVM that rely on this feature.

Based on some quick research, it sounds like there might be some issues with KVM support in QEMU on Asahi Linux, and maybe more specifically on vanilla M1 CPUs (as opposed to M1 Pro, Max, & Ultra), but most of the issues I've seen are with Windows, rather than just virtualizing NixOS on NixOS.

Build of 'linux-asahi' fails when `hardware.asahi.use4KPages = true`

The system builds fine when it is set to false. Occurs in default configuration.

System information:

  • device: M2 MacBook Air (16g RAM, 512g storage)
  • nix channel: nixos-unstable

Output of nixos-rebuild switch:

building Nix...
building the system configuration...
these 12 derivations will be built:
  /nix/store/0zh79jxidmsnjhy0qxvfx6mnkagnq0m0-linux-6.1.0-asahi.drv
  /nix/store/dk88i8xn8ziaqf222bwkycb1zjc9gqc4-boot.bin.drv
  /nix/store/z3f4g3vaxkhd5sv0qzn6xqm49v0q48an-copy-extra-files.drv
  /nix/store/bvn4lx7wl5jkxc8igdagzbqzrky6nn1a-systemd-boot-builder.py.drv
  /nix/store/cak34y6bc3pwvc3dvr0m5p17xg4qvw53-systemd-boot.drv
  /nix/store/1ypfzxxbkkypwjsnwwkhvkxcq423f25g-install-systemd-boot.sh.drv
  /nix/store/qm80rz049zqir027v41gcpfl1aq12vmm-linux-6.1.0-asahi-modules.drv
  /nix/store/xmwggk3lq134q90z80y09pcvwp9pvkvw-linux-6.1.0-asahi-modules-shrunk.drv
  /nix/store/n10y6jgbzvwl735kidrypv6idwvp7f3p-stage-1-init.sh.drv
  /nix/store/nr9lrapcaajm0vd9gpzpydgh9cia0556-initrd-linux-6.1.0-asahi.drv
  /nix/store/r59imdliv0lrr6npd5vrckpn2v69py4y-kernel-modules.drv
  /nix/store/b8zgk5ny0533r6zsyhg8fksscz2yz14a-nixos-system-M2NixOS-23.05pre-git.drv
building '/nix/store/0zh79jxidmsnjhy0qxvfx6mnkagnq0m0-linux-6.1.0-asahi.drv'...
unpacking sources
unpacking source archive /nix/store/aaijfm6z80pw06qnfpbqxdi7afbjg30m-source
source root is source
patching sources
applying patch /nix/store/2bjv3bjq46b39mfd0ib81pgkpq0afbbf-sven-iommu-4k.patch
patching file drivers/iommu/apple-dart.c
Hunk #1 FAILED at 97.
Hunk #2 FAILED at 115.
Hunk #3 FAILED at 499.
Hunk #4 succeeded at 862 (offset 232 lines).
Hunk #5 FAILED at 734.
Hunk #6 FAILED at 1119.
Hunk #7 FAILED at 1147.
6 out of 7 hunks FAILED -- saving rejects to file drivers/iommu/apple-dart.c.rej
patching file drivers/iommu/dma-iommu.c
Hunk #1 FAILED at 20.
Hunk #2 succeeded at 740 (offset 30 lines).
Hunk #3 succeeded at 782 (offset 30 lines).
Hunk #4 succeeded at 829 (offset 19 lines).
Hunk #5 succeeded at 865 (offset 31 lines).
Hunk #6 succeeded at 885 (offset 19 lines).
Hunk #7 FAILED at 1122.
Hunk #8 FAILED at 1164.
Hunk #9 FAILED at 1248.
Hunk #10 succeeded at 1599 (offset 105 lines).
4 out of 10 hunks FAILED -- saving rejects to file drivers/iommu/dma-iommu.c.rej
patching file drivers/iommu/iommu.c
Hunk #1 succeeded at 88 with fuzz 1 (offset 8 lines).
Hunk #2 succeeded at 1938 with fuzz 2 (offset -40 lines).
Hunk #3 succeeded at 1965 (offset -40 lines).
patching file drivers/iommu/iova.c
Hunk #1 succeeded at 54 (offset 5 lines).
patching file include/linux/iommu.h
Hunk #3 succeeded at 106 with fuzz 2.
error: builder for '/nix/store/0zh79jxidmsnjhy0qxvfx6mnkagnq0m0-linux-6.1.0-asahi.drv' failed with exit code 1
error: 1 dependencies of derivation '/nix/store/b8zgk5ny0533r6zsyhg8fksscz2yz14a-nixos-system-M2NixOS-23.05pre-git.drv' failed to build

linux-asahi from 2023-08-25 does not build with Rust support enabled

After today's update, I am unable to build the kernel. I am running NixOS 23.05, flake input updated just a couple of minutes ago (github:nixos/nixpkgs/fc944919f743bb22379dddf18dcb72db6cff84aa).

The kernel seems to build if I disable Rust support or use unstable.

Build log:

error: builder for '/nix/store/yg8a5k5g1zn8yysi32ial27074cciq0r-linux-6.4.0-asahi.drv' failed with exit code 1:

@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking sources
unpacking source archive /nix/store/b27f62ngi8b36l60zirx9djxc237xhqp-source
source root is source
@nix { "action": "setPhase", "phase": "patchPhase" }
patching sources
applying patch /nix/store/j217pbp9pqv3z336nv6lx8fhrzdb5pmj-rust-bindgen-version.patch
patching file scripts/rust_is_available.sh
applying patch /nix/store/f3yvg9zp5lisfrfdw5szqn6v4h47nx6h-default-pagesize-16k.patch
patching file arch/arm64/Kconfig
Hunk #1 succeeded at 1197 (offset 161 lines).
applying patch /nix/store/a6jy7ivg8dljlap45ccwrx93j3bh05zb-rust-bindgen-0.63-fix.patch
patching file rust/Makefile
Hunk #1 succeeded at 321 (offset -12 lines).
applying patch /nix/store/fc3pfhi9cxzgiwdwf32w96hpl78imwis-rust-bindgen-0.65-fix.patch
patching file rust/Makefile
Hunk #1 succeeded at 301 (offset 13 lines).
applying patch /nix/store/zac8l1vmba0kzl6md10anps8ay9dn798-rust_1_71_0.patch
patching file rust/Makefile
Reversed (or previously applied) patch detected!  Assume -R? [n] 
Apply anyway? [n] 
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file rust/Makefile.rej
patching file rust/compiler_builtins.rs
Reversed (or previously applied) patch detected!  Assume -R? [n] 
Apply anyway? [n] 
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file rust/compiler_builtins.rs.rej
patching file rust/alloc/alloc.rs
Hunk #1 FAILED at 337.
1 out of 1 hunk FAILED -- saving rejects to file rust/alloc/alloc.rs.rej
patching file rust/alloc/boxed.rs
Hunk #1 FAILED at 380.
Hunk #2 FAILED at 410.
Hunk #3 FAILED at 445.
Hunk #4 FAILED at 486.
Hunk #5 FAILED at 517.
Hunk #6 FAILED at 558.
Hunk #7 FAILED at 577.
Hunk #8 FAILED at 591.
Hunk #9 FAILED at 609.
Hunk #10 FAILED at 828.
Hunk #11 FAILED at 863.
Hunk #12 FAILED at 1109.
Hunk #13 FAILED at 1121.
Hunk #14 FAILED at 1140.
Hunk #15 FAILED at 1182.
Hunk #16 FAILED at 1460.
Hunk #17 FAILED at 1898.
Hunk #18 FAILED at 1908.
18 out of 18 hunks FAILED -- saving rejects to file rust/alloc/boxed.rs.rej
patching file rust/alloc/lib.rs
Reversed (or previously applied) patch detected!  Assume -R? [n] 
Apply anyway? [n] 
Skipping patch.
2 out of 2 hunks ignored -- saving rejects to file rust/alloc/lib.rs.rej
patching file rust/alloc/vec/mod.rs
Reversed (or previously applied) patch detected!  Assume -R? [n] 
Apply anyway? [n] 
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file rust/alloc/vec/mod.rs.rej
patching file rust/kernel/allocator.rs
Hunk #1 FAILED at 26.
1 out of 1 hunk FAILED -- saving rejects to file rust/kernel/allocator.rs.rej
patching file rust/kernel/driver.rs
Reversed (or previously applied) patch detected!  Assume -R? [n] 
Apply anyway? [n] 
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file rust/kernel/driver.rs.rej

I suspect the version chosen for the Rust patch check is wrong - I attempted to skip the patch and the kernel seems to be building. I'll report later whether the compilation managed to finish.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.