about summary refs log tree commit diff
diff options
context:
space:
mode:
authorThomas Watson <twatson52@icloud.com>2021-12-20 11:34:12 -0600
committerThomas Watson <twatson52@icloud.com>2021-12-20 11:48:06 -0600
commitd2fa53a63f5170f8924ded2c1b1682ce19f214a7 (patch)
tree9b77a42d2244fdaabb78347c53d0a7e1cd93d9c1
parent4b9b379eba1fa45ce4d2981b19104f6b3ce87c77 (diff)
downloadnixlib-d2fa53a63f5170f8924ded2c1b1682ce19f214a7.tar
nixlib-d2fa53a63f5170f8924ded2c1b1682ce19f214a7.tar.gz
nixlib-d2fa53a63f5170f8924ded2c1b1682ce19f214a7.tar.bz2
nixlib-d2fa53a63f5170f8924ded2c1b1682ce19f214a7.tar.lz
nixlib-d2fa53a63f5170f8924ded2c1b1682ce19f214a7.tar.xz
nixlib-d2fa53a63f5170f8924ded2c1b1682ce19f214a7.tar.zst
nixlib-d2fa53a63f5170f8924ded2c1b1682ce19f214a7.zip
remove old and busted guide and rootfs
-rw-r--r--README.md2
-rw-r--r--docs/qnd-standalone.md170
-rw-r--r--nix/overlay.nix1
-rw-r--r--nix/rootfs-bootstrap-cross/default.nix17
-rw-r--r--nix/rootfs-bootstrap-cross/ext4-image.nix81
-rw-r--r--nix/rootfs-bootstrap-cross/installer-configuration.nix89
-rw-r--r--nix/rootfs-bootstrap-cross/sample-configuration.nix107
-rw-r--r--nix/u-boot/0001-add-extlinux-vars.patch100
-rw-r--r--nix/u-boot/0001-m1n1-fdt-compat.patch401
-rw-r--r--nix/u-boot/default.nix6
10 files changed, 2 insertions, 972 deletions
diff --git a/README.md b/README.md
index 6a0c50805f3b..8662ea968d09 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,5 @@
 Attempts to get NixOS up on M1 Macs.
 
-* [Quick and Dirty Standalone NixOS](docs/qnd-standalone.md)
-
 ## 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 Linux on M1 experience include:
diff --git a/docs/qnd-standalone.md b/docs/qnd-standalone.md
deleted file mode 100644
index 60e77c637c82..000000000000
--- a/docs/qnd-standalone.md
+++ /dev/null
@@ -1,170 +0,0 @@
-# Quick and Dirty Standalone NixOS
-
-This guide will explain how to install NixOS on the internal NVMe drive of an M1 Mac (M1 Pro/Max are not supported at this time), then boot it without the help of another computer. The process of preparing the Mac for installation of Linux is currently in flux, and will not be described here. If you want to follow this guide, you should already have a working m1n1 install which can display stuff on your screen and you can interact with over USB. Additionally, you should have created a blank partition on the internal NVMe drive separate from the macOS stub partition which is at least 5GB (10GB for full GUI).
-
-## Warning
-
-Damage to the macOS recovery partitions or the partition table could result in the Mac becoming unbootable and loss of all data on the internal NVMe drive. In this circumstance, a suitable USB cable and another computer which can run [idevicerestore](https://github.com/libimobiledevice/idevicerestore) will be required to perform a DFU upgrade and restore normal operation.
-
-This also does not necessarily promise to be useful. Just because you can do it doesn't mean you should. A lot of features are currently missing, and this guide has only been tested on an M1 Mac mini. But, it is pretty cool.
-
-## Prerequisites
-
-The following items are required to get started:
-* M1 Mac with working m1n1 setup (M1 Pro/Max are not supported by U-Boot yet) and a blank partition, separate from the macOS stub partition, which is at least 5GB (10GB for full GUI)
-* For Mac mini users: tested and working HDMI monitor. Many do not work properly; if it shows the Asahi Linux logo and console when m1n1 is running, it's fine. Note that HDMI is at this time broken completely if the stub partition has a macOS newer than 11.4.
-* Ethernet cable (WiFi drivers are not incorporated yet)
-* USB keyboard and mouse (internal keyboards are not supported by U-Boot yet, and may not work in Linux at the moment)
-* For laptop users: USB to Ethernet adapter, USB A to C adapter, and hub
-* An x86_64 Linux PC (any distro is fine) on the same network as the Mac
-* Familiarity with the command line and installers without GUIs
-
-## Software Preparation
-
-#### Nix
-
-This setup takes advantage of the Nix package manager, which handles downloading and compiling everything. You must first install it on your Linux host PC if it doesn't run NixOS. Most distros are compatible, and installation (and uninstallation) is simple. Instructions are available on the [NixOS website](https://nixos.org/download.html#nix-quick-install).
-
-#### nixos-m1
-
-Clone the repository to a suitable location on the host PC. In the future, you can update this repository and re-run the `nix-build` commands to update things.
-
-```
-$ git clone https://github.com/tpwrules/nixos-m1/
-$ cd nixos-m1
-```
-
-#### m1n1
-
-Change directories to the repository, then use Nix to build m1n1 and symlink the result to `m1n1`:
-
-```
-nixos-m1$ nix-build -A m1n1 -o m1n1
-```
-
-m1n1 has been built and the `.macho` and `.bin` files are now in `m1n1/build/`. You can also run m1n1's scripts such as `chainload.py` using a command like `m1n1/bin/m1n1-chainload`.
-
-#### U-Boot
-
-U-Boot depends on a device tree specific to each type of Mac. The list of devices is available in the [Asahi documentation](https://github.com/AsahiLinux/docs/wiki/Devices). For example, the Mac mini has SOC T8103 and Product J274AP. This means its device tree is `t8103-j274`.
-
-Use Nix to build U-Boot along with m1n1 and the device tree for your Mac. This command builds a U-Boot with the Mac mini device tree:
-
-```
-nixos-m1$ nix-build -A u-boot.t8103-j274 -o u-boot
-```
-
-The `.macho` and `.bin` files with m1n1, the device tree, and U-Boot joined together are now in `u-boot/`.
-
-#### Kernel and Bootstrap Root Filesystem
-
-The bootstrap root filesystem image contains the Asahi Linux kernel, initrd, and enough packages and drivers to allow connection to the internet in order to download and install a full NixOS system.
-
-Building the image requires downloading of a large amount of data and compilation of a number of packages, including the kernel. On my six core Xeon laptop, building it took about 8 minutes (61 CPU minutes). Your mileage may vary. You can use the `-j` option to specify the number of packages to build in parallel. Each is allowed to use all cores, but for this build, most do not use more than one. Therefore, it is recommended to set it to less than the number of physical cores in your machine.
-
-Use Nix to build the filesystem image:
-
-```
-nixos-m1$ nix-build -A rootfs-bootstrap-cross -o rootfs -j4
-```
-
-The compressed image is now available in `rootfs/ext4-image/nixos_root.img.tar.gz`.
-
-## Installation
-
-#### U-Boot and Filesystem
-
-Figure out the IP of the host Linux PC where you built everything (using e.g. `ip addr`). On that PC, change directories into the git repo and start an HTTP server for the Mac to download the files from:
-
-```
-nixos-m1$ nix-shell -p python3 --run 'python3 -m http.server'
-```
-
-Boot the Mac into 1TR and open the Terminal. Download the U-Boot image (replacing `.macho` with `.bin` if appropriate) and the compressed root filesystem from the host PC:
-
-```
-# curl http://<host PC IP>:8000/u-boot/u-boot.macho -o u-boot.macho
-# curl http://<host PC IP>:8000/rootfs/ext4-image/nixos_root.img.tar.gz -o nixos_root.img.tar.gz
-```
-
-Use `kmutil` to install the `.macho` or `.bin` according to the [m1n1 manual](https://github.com/AsahiLinux/m1n1#usage), depending on your system.
-
-```
-# kmutil configure-boot <...>
-```
-
-In the Terminal, use the `diskutil list /dev/disk0` command to determine the blank partition on which to install the root filesystem (this is not the stub partition).
-
-**DANGER: Damage to the first partition (`Apple_APFS_ISC`) or the last partition (`Apple_APFS_Recovery`) will render the Mac unbootable and unrecoverable without assistance from another computer!**
-
-Having heeded the warning above, write the root filesystem to the appropriate partition, where `N` is its number, then shut down the machine:
-
-```
-# tar -xOf nixos_root.img.tar.gz | dd of=/dev/disk0sN bs=1m
-# shutdown -h now
-```
-
-If on a laptop, connect your USB peripherals to a USB-C port through the USB A to C adapter. If on a Mac mini, you can use either the USB-A or USB-C ports. Connect the Ethernet cable to the network port or adapter as well.
-
-Start the Mac, and U-Boot should start. After a short delay, NixOS will then start, and you will get a login prompt once booting completes.
-
-#### NixOS Configuration
-
-Create yourself a user account (here `foo`) with `sudo` privileges and give it a password:
-
-```
-nixos$ sudo useradd -G wheel -m foo
-nixos$ sudo passwd foo
-```
-
-A working NixOS configuration file has been included in the root filesystem for you. Use `nano` to edit the file (other editors have been left out of the bootstrap filesystem to save space and time). Uncomment the relevant options and change their values as explained in the file. Refer to the [NixOS installation manual](https://nixos.org/manual/nixos/stable/index.html#ch-configuration) for further guidance (most documentation has also been left out of the bootstrap filesystem).
-
-```
-nixos$ sudo nano /etc/nixos/configuration.nix
-```
-
-Once you are satisfied with the configuration, rebuild the system to install it, then reboot the system. This will also have to download a large amount of data. If there are SSL errors, wait a minute or so for the time to be set correctly over the network.
-
-```
-nixos$ sudo nixos-rebuild boot
-nixos$ sudo reboot
-```
-
-U-Boot will prompt you to select your new system (Configuration 2) or the old system, which is the installer (Configuration 1). If you wait a few seconds, it will automatically boot the latest configuration. Your new system should now start and can be used like any other NixOS system. Refer to the manual for more information on how to use NixOS.
-
-Note that Linux currently cannot completely shut down the system. Once you issue the command, you will have to hold the power button until the power shuts off completely. Rebooting should work fine though.
-
-If something goes wrong, you can go back to the installer by selecting Configuration 1 in the U-Boot menu (option 3 if you have only rebuilt the system once). Once back in the installer, you can edit the configuration again and re-rebuild the system.
-
-Otherwise, if you want to edit the system configuration, you can install and use your favorite editor to change `/etc/nixos/configuration.nix`, then rerun `sudo nixos-rebuild boot` and reboot to switch to it. You can use U-Boot to switch back to the previous configuration if things don't pan out.
-
-To update the Asahi kernel, you can download the files under `nix/kernel` from this repo and place them under `/etc/nixos/kernel`. Alternately, you can edit the kernel config in `/etc/nixos/kernel/config` and rebuild the system to test modifications. Consult the comments in `/etc/nixos/configuration.nix` and `/etc/nixos/kernel/default.nix` for more details.
-
-#### Hypervisor Boot
-
-Once the root filesystem is installed, you can also choose to install m1n1 without U-Boot and run U-Boot and the OS under m1n1's hypervisor. To do this, instead download `m1n1/build/m1n1.macho` (or `.bin`) and install it using `kmutil`.
-
-To run U-Boot under the hypervisor, start m1n1 and attach the Mac to the host PC using an appropriate USB cable, change directories to the repo, then run:
-
-```
-nixos-m1$ m1n1/bin/m1n1-run_guest u-boot/u-boot.macho
-```
-
-To access the serial console, in a separate terminal run:
-
-```
-$ nix-shell -p picocom --run 'picocom /dev/ttyACM1'
-```
-
-Downloading the kernel over USB is not supported at this time.
-
-#### Cleanup
-
-To recover the space on the host PC, change directories into the repo, remove the built symlinks (removing just the rootfs will recover almost all the space), then run the garbage collector:
-
-```
-nixos-m1$ rm m1n1 u-boot rootfs
-nixos-m1$ nix-collect-garbage
-```
-
-To remove NixOS from the Mac, just delete the partition (taking care to not touch the recovery partitions) and reinstall m1n1 using `kmutil`.
diff --git a/nix/overlay.nix b/nix/overlay.nix
index cfdab3945a78..63e8df7e87a4 100644
--- a/nix/overlay.nix
+++ b/nix/overlay.nix
@@ -21,7 +21,6 @@ in {
     u-boot = lib.genAttrs compatibleDTs (
       name: callPackage ./u-boot { withDeviceTree = name; }
     );
-    rootfs-bootstrap-cross = callPackage ./rootfs-bootstrap-cross {};
     installer-bootstrap-cross = callPackage ./installer-bootstrap-cross {};
   });
 }
diff --git a/nix/rootfs-bootstrap-cross/default.nix b/nix/rootfs-bootstrap-cross/default.nix
deleted file mode 100644
index 15e1aabe324c..000000000000
--- a/nix/rootfs-bootstrap-cross/default.nix
+++ /dev/null
@@ -1,17 +0,0 @@
-# mod of https://github.com/samueldr/cross-system/blob/master/default.nix
-
-{ pkgs }:
-
-let
-  nixpkgsPath = pkgs.path;
-  fromPkgs = path: pkgs.path + "/${path}";
-  evalConfig = import (fromPkgs "nixos/lib/eval-config.nix");
-in (evalConfig {
-  specialArgs = {
-    inherit nixpkgsPath;
-  };
-  modules = [
-    ./installer-configuration.nix
-    ./ext4-image.nix
-  ];
-}).config.system.build.ext4Image
diff --git a/nix/rootfs-bootstrap-cross/ext4-image.nix b/nix/rootfs-bootstrap-cross/ext4-image.nix
deleted file mode 100644
index 9e322a8e8b52..000000000000
--- a/nix/rootfs-bootstrap-cross/ext4-image.nix
+++ /dev/null
@@ -1,81 +0,0 @@
-# mod of https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/installer/sd-card/sd-image.nix
-
-{ config, lib, pkgs, ... }:
-
-with lib;
-
-let
-  rootfsImage = pkgs.callPackage "${pkgs.path}/nixos/lib/make-ext4-fs.nix" ({
-    inherit (config.sdImage) storePaths;
-    compressImage = false;
-    populateImageCommands = config.sdImage.populateRootCommands;
-    volumeLabel = "NIXOS_SD";
-  } // optionalAttrs (config.sdImage.rootPartitionUUID != null) {
-    uuid = config.sdImage.rootPartitionUUID;
-  });
-
-  # we use tar and gzip to compress the image instead of the default zstd so
-  # that it can be transferred and decompressed in recoveryOS (which doesn't
-  # even have bare gzip, only tar!!!)
-  compressedImage = if !config.sdImage.compressImage then rootfsImage else (
-    pkgs.callPackage ({ pigz }: rootfsImage.overrideAttrs (o: {
-      name = o.name + ".tar.gz";
-      nativeBuildInputs = o.nativeBuildInputs ++ [ pigz ];
-      buildCommand = ''
-        imgout=$out
-        out=nixos_root.img
-      '' + o.buildCommand + ''
-        out=$imgout
-        echo "Compressing image"
-        tar c nixos_root.img | pigz -p $NIX_BUILD_CORES -c > $out
-      '';
-    })
-  )) {};
-in
-{
-  config = {
-    system.build.ext4Image = let
-      ext4Name = replaceStrings ["sd"] ["ext4"] config.sdImage.imageName;
-    in pkgs.callPackage ({ stdenv }: stdenv.mkDerivation {
-      name = ext4Name;
-
-      inherit (config.sdImage) compressImage;
-
-      buildCommand = ''
-        mkdir -p $out/nix-support $out/ext4-image
-        export img=$out/ext4-image/nixos_root.img
-        if test -n "$compressImage"; then
-            export img=$img.tar.gz
-        fi
-
-        echo "${pkgs.stdenv.buildPlatform.system}" > $out/nix-support/system
-        echo "file ext4-image $img" >> $out/nix-support/hydra-build-products
-
-        ln -s ${compressedImage} $img
-      '';
-    }) {};
-
-    sdImage.expandOnBoot = lib.mkForce false;
-
-    boot.postBootCommands = ''
-      # On the first boot do some maintenance tasks
-      if [ -f /nix-path-registration ]; then
-        set -euo pipefail
-        set -x
-        # Figure out device names for the boot device and root filesystem.
-        rootPart=$(${pkgs.util-linux}/bin/findmnt -n -o SOURCE /)
-        bootDevice=$(lsblk -npo PKNAME $rootPart)
-        partNum=$(lsblk -npo MAJ:MIN $rootPart | ${pkgs.gawk}/bin/awk -F: '{print $2}')
-        # Resize the filesystem to fit the disk
-        ${pkgs.e2fsprogs}/bin/resize2fs $rootPart
-        # Register the contents of the initial Nix store
-        ${config.nix.package.out}/bin/nix-store --load-db < /nix-path-registration
-        # nixos-rebuild also requires a "system" profile and an /etc/NIXOS tag.
-        touch /etc/NIXOS
-        ${config.nix.package.out}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system
-        # Prevents this from running on later boots.
-        rm -f /nix-path-registration
-      fi
-    '';
-  };
-}
diff --git a/nix/rootfs-bootstrap-cross/installer-configuration.nix b/nix/rootfs-bootstrap-cross/installer-configuration.nix
deleted file mode 100644
index f5c2d9c57c42..000000000000
--- a/nix/rootfs-bootstrap-cross/installer-configuration.nix
+++ /dev/null
@@ -1,89 +0,0 @@
-# this configuration is intended to have just enough stuff to get the disk,
-# display, USB input, and network up so the user can build a real config.
-
-# based on https://github.com/samueldr/cross-system/blob/master/configuration.nix
-
-{ config, pkgs, lib, nixpkgsPath, ... }:
-
-{
-  imports = [
-    (nixpkgsPath + "/nixos/modules/profiles/minimal.nix")
-    (nixpkgsPath + "/nixos/modules/profiles/installation-device.nix")
-    (nixpkgsPath + "/nixos/modules/installer/sd-card/sd-image.nix")
-  ];
-
-  sdImage.populateRootCommands = ''
-    mkdir -p ./files/boot
-    ${config.boot.loader.generic-extlinux-compatible.populateCmd} -c ${config.system.build.toplevel} -d ./files/boot
-
-    mkdir -p ./files/etc/nixos/kernel
-    cp -r ${../kernel}/* ./files/etc/nixos/kernel
-    cp ${./sample-configuration.nix} ./files/etc/nixos/configuration.nix
-    chmod +w -R ./files/etc/nixos/
-  '';
-
-  installer.cloneConfig = false;
-
-  boot.loader.grub.enable = false;
-  boot.loader.generic-extlinux-compatible.enable = true;
-
-  boot.consoleLogLevel = 7;
-
-  boot.kernelParams = [
-    "earlycon"
-    "console=ttySAC0,1500000"
-    "console=tty0"
-    "debug"
-    "boot.shell_on_fail"
-  ];
-
-  boot.kernelPackages = pkgs.callPackage ../kernel { nativeBuild = false; };
-
-  # our kernel config is weird and doesn't have these modules as modules
-  boot.initrd.availableKernelModules = lib.mkForce [];
-
-  # save space and compilation time. might revise?
-  hardware.enableAllFirmware = lib.mkForce false;
-  hardware.enableRedistributableFirmware = lib.mkForce false;
-  sound.enable = false;
-  networking.wireless.enable = false;
-  documentation.nixos.enable = lib.mkOverride 49 false;
-  system.extraDependencies = lib.mkForce [ ];
-
-  hardware.wirelessRegulatoryDatabase = true;
-  hardware.firmware = [
-    # all the firmware is big, but including the tigon one avoids an awkward
-    # minute long hang on mac mini
-    (pkgs.stdenv.mkDerivation {
-      name = "tigon-firmware";
-      buildCommand = ''
-        mkdir -p $out/lib/firmware
-        cp -r ${pkgs.firmwareLinuxNonfree}/lib/firmware/tigon $out/lib/firmware
-      '';
-    })
-  ];
-
-  # (Failing build in a dep to be investigated)
-  security.polkit.enable = false;
-
-  # cifs-utils fails to cross-compile
-  # Let's simplify this by removing all unneeded filesystems from the image.
-  boot.supportedFilesystems = lib.mkForce [ "vfat" ];
-
-  # texinfoInteractive has trouble cross-compiling
-  documentation.info.enable = lib.mkForce false;
-
-  # `xterm` is being included even though this is GUI-less.
-  # → https://github.com/NixOS/nixpkgs/pull/62852
-  services.xserver.desktopManager.xterm.enable = lib.mkForce false;
-
-  # ec6224b6cd147943eee685ef671811b3683cb2ce re-introduced udisks in the installer
-  # udisks fails due to gobject-introspection being not cross-compilation friendly.
-  services.udisks2.enable = lib.mkForce false;
-
-  networking.firewall.enable = false;
-
-  nixpkgs.crossSystem = {
-    system = "aarch64-linux";
-  };
-}
diff --git a/nix/rootfs-bootstrap-cross/sample-configuration.nix b/nix/rootfs-bootstrap-cross/sample-configuration.nix
deleted file mode 100644
index 99c3272f01ef..000000000000
--- a/nix/rootfs-bootstrap-cross/sample-configuration.nix
+++ /dev/null
@@ -1,107 +0,0 @@
-# Edit this configuration file to define what should be installed on
-# your system.  Help is available in the configuration.nix(5) man page
-# and in the NixOS manual (accessible online at
-# https://nixos.org/manual/nixos/stable/index.html#sec-installation).
-
-{ config, pkgs, lib, ... }:
-
-{
-  # Enables the generation of /boot/extlinux/extlinux.conf
-  # GRUB cannot correctly load device trees, so do not change this.
-  boot.loader.grub.enable = false;
-  boot.loader.generic-extlinux-compatible.enable = true;
-
-  # Use the customized Asahi Linux kernel.
-  # If you wish to modify the kernel, see /etc/nixos/kernel/default.nix.
-
-  # IMPORTANT: if you have to build the kernel on the Mac itself, set
-  # nativeBuild here to `true`. If you don't, Nix will complain that it
-  # cannot find an x86_64-linux builder.
-  boot.kernelPackages = pkgs.callPackage ./kernel { nativeBuild = false; };
-
-  boot.consoleLogLevel = 7;
-  boot.kernelParams = lib.mkForce [
-    "earlycon"
-    "console=ttySAC0,1500000"
-    "console=tty0"
-    "debug"
-    "boot.shell_on_fail"
-  ];
-
-  # networking.hostName = "nixos"; # Define your hostname.
-
-  # Set your time zone.
-  # time.timeZone = "Europe/Amsterdam";
-
-  # Change this to the name of your interface, available via `ip addr`.
-  # `enp3s0` is the internal interface on the Mac mini.
-  networking.interfaces.enp3s0.useDHCP = true;
-
-  # Configure network proxy if necessary
-  # networking.proxy.default = "http://user:password@proxy:port/";
-  # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
-
-  # Select internationalisation properties.
-  # i18n.defaultLocale = "en_US.UTF-8";
-  # console = {
-  #   font = "Lat2-Terminus16";
-  #   keyMap = "us";
-  # };
-
-  # Enable the X11 windowing system and at least one desktop manager.
-  # services.xserver.enable = true;
-  # services.xserver.desktopManager.xfce.enable = true;
-
-  # Configure keymap in X11
-  # services.xserver.layout = "us";
-  # services.xserver.xkbOptions = "eurosign:e";
-
-  # Enable touchpad support (enabled default in most desktopManager).
-  # services.xserver.libinput.enable = true;
-
-  # List packages installed in system profile. To search, run:
-  # $ nix search wget
-  environment.systemPackages = with pkgs; [
-  #   vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
-  #   wget
-  #   firefox
-  ];
-
-  # Some programs need SUID wrappers, can be configured further or are
-  # started in user sessions.
-  # programs.mtr.enable = true;
-  # programs.gnupg.agent = {
-  #   enable = true;
-  #   enableSSHSupport = true;
-  # };
-
-  # List services that you want to enable:
-
-  # Enable the OpenSSH daemon.
-  # services.openssh.enable = true;
-
-  # nftables support is not yet in the kernel config, so enabling the firewall
-  # does not work yet
-  networking.firewall.enable = false;
-
-  # our kernel config is weird so don't try to include any modules
-  boot.initrd.availableKernelModules = lib.mkForce [ ];
-
-  # do not change these, they match the built root FS and partition layout
-  fileSystems."/" =
-    { device = "/dev/disk/by-uuid/44444444-4444-4444-8888-888888888888";
-      fsType = "ext4";
-    };
-  swapDevices = [ ];
-
-  hardware.firmware = [ pkgs.firmwareLinuxNonfree ];
-
-  # This value determines the NixOS release from which the default
-  # settings for stateful data, like file locations and database versions
-  # on your system were taken. It‘s perfectly fine and recommended to leave
-  # this value at the release version of the first install of this system.
-  # Before changing this value read the documentation for this option
-  # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
-  system.stateVersion = "22.05"; # Did you read the comment?
-
-}
diff --git a/nix/u-boot/0001-add-extlinux-vars.patch b/nix/u-boot/0001-add-extlinux-vars.patch
deleted file mode 100644
index 81a5054164d8..000000000000
--- a/nix/u-boot/0001-add-extlinux-vars.patch
+++ /dev/null
@@ -1,100 +0,0 @@
-diff --git a/arch/arm/mach-apple/board.c b/arch/arm/mach-apple/board.c
-index d61ab1ee1e..8e4b00293c 100644
---- a/arch/arm/mach-apple/board.c
-+++ b/arch/arm/mach-apple/board.c
-@@ -73,11 +73,58 @@ static struct mm_region apple_mem_map[] = {
- 
- struct mm_region *mem_map = apple_mem_map;
- 
-+static void apple_set_env_fdt_file(void)
-+{
-+	char dtb_name[64];
-+
-+	if (env_get("fdtfile"))
-+		return;
-+
-+	const char *soc = NULL;
-+	const char *product = NULL;
-+
-+	int num_compats = fdt_stringlist_count(gd->fdt_blob, 0, "compatible");
-+	if (num_compats < 0)
-+		return;
-+
-+	for (int i=0; i<num_compats; i++)
-+	{
-+		const char *compat = fdt_stringlist_get(
-+			gd->fdt_blob, 0, "compatible", i, NULL);
-+
-+		compat = strchr(compat, ',');
-+		if (!compat)
-+			continue;
-+		compat++;
-+
-+		if (*compat == 't') {
-+			soc = compat;
-+		} else if (*compat == 'j') {
-+			product = compat;
-+		}
-+	}
-+
-+	if (!soc || !product)
-+		return;
-+
-+	snprintf(dtb_name, sizeof(dtb_name), "apple/%s-%s.dtb", soc, product);
-+	dtb_name[sizeof(dtb_name)-1] = '\0';
-+
-+	env_set("fdtfile", dtb_name);
-+}
-+
- int board_init(void)
- {
- 	return 0;
- }
- 
-+int board_late_init(void)
-+{
-+	apple_set_env_fdt_file();
-+
-+	return 0;
-+}
-+
- int dram_init(void)
- {
- 	ofnode node;
-diff --git a/configs/apple_m1_defconfig b/configs/apple_m1_defconfig
-index 85687fe234..afb89202f6 100644
---- a/configs/apple_m1_defconfig
-+++ b/configs/apple_m1_defconfig
-@@ -1,5 +1,6 @@
- CONFIG_ARM=y
- CONFIG_ARCH_APPLE=y
-+CONFIG_BOARD_LATE_INIT=y
- # CONFIG_DISPLAY_CPUINFO is not set
- # CONFIG_MMC is not set
- # CONFIG_NET is not set
-diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
-index 2627c2a6a5..29fe28e882 100644
---- a/include/config_distro_bootcmd.h
-+++ b/include/config_distro_bootcmd.h
-@@ -476,7 +476,7 @@
- 		"\0"                                                      \
- 	\
- 	"scan_dev_for_boot_part="                                         \
--		"part list ${devtype} ${devnum} -bootable devplist; "     \
-+		"part list ${devtype} ${devnum} devplist; "    /* M1 note: try to boot all partitions in case user DD'd an image as it's difficult to make bootable from recoveryOS */ \
- 		"env exists devplist || setenv devplist 1; "              \
- 		"for distro_bootpart in ${devplist}; do "                 \
- 			"if fstype ${devtype} "                           \
-diff --git a/include/configs/apple.h b/include/configs/apple.h
-index 3c0365b49e..b5632a7866 100644
---- a/include/configs/apple.h
-+++ b/include/configs/apple.h
-@@ -19,6 +19,8 @@
- 	"stderr=serial,vidconsole\0"
- 
- #define ENV_MEM_LAYOUT_SETTINGS \
-+	"ramdisk_addr_r=0x950000000\0" \
-+	"scriptaddr=0x960000000\0" \
- 	"fdt_addr_r=0x960100000\0" \
- 	"kernel_addr_r=0x960200000\0"
- 
diff --git a/nix/u-boot/0001-m1n1-fdt-compat.patch b/nix/u-boot/0001-m1n1-fdt-compat.patch
deleted file mode 100644
index bb58ceb36f02..000000000000
--- a/nix/u-boot/0001-m1n1-fdt-compat.patch
+++ /dev/null
@@ -1,401 +0,0 @@
-diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
-index e9d5627290..a25b9bc397 100644
---- a/arch/arm/Kconfig
-+++ b/arch/arm/Kconfig
-@@ -937,6 +937,7 @@ config ARCH_APPLE
- 	select MISC
- 	select OF_CONTROL
- 	select OF_BOARD
-+	select OF_BOARD_SETUP
- 	select PCI
- 	select PINCTRL
- 	select USB
-diff --git a/arch/arm/include/asm/arch-apple/m1n1_compat.h b/arch/arm/include/asm/arch-apple/m1n1_compat.h
-new file mode 100644
-index 0000000000..27ce468f99
---- /dev/null
-+++ b/arch/arm/include/asm/arch-apple/m1n1_compat.h
-@@ -0,0 +1,6 @@
-+// SPDX-License-Identifier: GPL-2.0+
-+/*
-+ * (C) Copyright 2021 Thomas Watson <twatson52@icloud.com>
-+ */
-+
-+int apple_m1n1_update_fdt(void *, void*);
-diff --git a/arch/arm/mach-apple/Makefile b/arch/arm/mach-apple/Makefile
-index 52f30a777b..b4008844a0 100644
---- a/arch/arm/mach-apple/Makefile
-+++ b/arch/arm/mach-apple/Makefile
-@@ -3,3 +3,4 @@
- obj-y += board.o
- obj-y += lowlevel_init.o
- obj-y += rtkit.o
-+obj-y += m1n1_compat.o
-\ No newline at end of file
-diff --git a/arch/arm/mach-apple/board.c b/arch/arm/mach-apple/board.c
-index b4a7a51dc2..8d2eeb8edb 100644
---- a/arch/arm/mach-apple/board.c
-+++ b/arch/arm/mach-apple/board.c
-@@ -11,6 +11,7 @@
- #include <asm/global_data.h>
- #include <asm/io.h>
- #include <asm/system.h>
-+#include <asm/arch-apple/m1n1_compat.h>
- 
- DECLARE_GLOBAL_DATA_PTR;
- 
-@@ -163,3 +164,11 @@ unsigned long get_uart_clk(int dev_index)
- {
- 	return 24000000;
- }
-+
-+int ft_board_setup(void *blob, struct bd_info *bd)
-+{
-+	if (apple_m1n1_update_fdt(blob, (void *)fw_dtb_pointer))
-+		return -1;
-+
-+	return 0;
-+}
-diff --git a/arch/arm/mach-apple/m1n1_compat.c b/arch/arm/mach-apple/m1n1_compat.c
-new file mode 100644
-index 0000000000..4688e54d6f
---- /dev/null
-+++ b/arch/arm/mach-apple/m1n1_compat.c
-@@ -0,0 +1,337 @@
-+// SPDX-License-Identifier: GPL-2.0+
-+/*
-+ * (C) Copyright 2021 Thomas Watson <twatson52@icloud.com>
-+ */
-+
-+#include <common.h>
-+#include <fdt_support.h>
-+
-+#define problem(...)			\
-+	do {						\
-+		printf(__VA_ARGS__);	\
-+		return -1;				\
-+	} while (0)
-+
-+static int copy_mem(void *fdt, void *fw_fdt)
-+{
-+	int fw_node = fdt_path_offset(fw_fdt, "/memory");
-+	if (fw_node < 0)
-+		problem("memory node missing from firmware\n");
-+
-+	int node = fdt_path_offset(fdt, "/memory");
-+	if (node < 0)
-+		problem("memory node missing\n");
-+
-+	int len;
-+	const void *memreg = fdt_getprop(fw_fdt, fw_node, "reg", &len);
-+	if (!memreg)
-+		problem("could not get reg property of /memory\n");
-+
-+	if (fdt_setprop(fdt, node, "reg", memreg, len))
-+		problem("could not set reg property of /memory\n");
-+
-+	return 0;
-+}
-+
-+static int copy_mem_rsv(void *fdt, void *fw_fdt)
-+{
-+	int num_rsvs = fdt_num_mem_rsv(fw_fdt);
-+	for (int rsv = 0; rsv < num_rsvs; rsv++)
-+	{
-+		u64 address, size;
-+		if (fdt_get_mem_rsv(fw_fdt, rsv, &address, &size))
-+			problem("could not get mem rsv %d\n", rsv);
-+
-+		if (fdt_add_mem_rsv(fdt, address, size))
-+			problem("could not add mem rsv %d\n", rsv);
-+	}
-+
-+	return 0;
-+}
-+
-+static int copy_rng_seed(void *fdt, void *fw_fdt)
-+{
-+	int fw_node = fdt_path_offset(fw_fdt, "/chosen");
-+	if (fw_node < 0)
-+		problem("chosen node missing from firmware\n");
-+
-+	int node = fdt_path_offset(fdt, "/chosen");
-+	if (node < 0)
-+		problem("chosen node missing\n");
-+
-+	int len;
-+	const void *seed = fdt_getprop(fw_fdt, fw_node, "rng-seed", &len);
-+	if (!seed) /* might not be present if m1n1 did not get enough entropy */
-+		return 0;
-+
-+	if (fdt_setprop(fdt, node, "rng-seed", seed, len))
-+		problem("could not set rng-seed property of /chosen\n");
-+
-+	seed = fdt_getprop(fw_fdt, fw_node, "kaslr-seed", &len);
-+	if (!seed) /* might not be present if m1n1 did not get enough entropy */
-+		return 0;
-+
-+	if (fdt_setprop(fdt, node, "kaslr-seed", seed, len))
-+		problem("could not set kaslr-seed property of /chosen\n");
-+
-+	return 0;
-+}
-+
-+static int copy_framebuffer(void *fdt, void *fw_fdt)
-+{
-+	int fw_node = fdt_path_offset(fw_fdt, "/chosen/framebuffer");
-+	if (fw_node < 0) /* might not be present if m1n1 did not set it up */
-+		return 0;
-+
-+	int node = fdt_path_offset(fdt, "/chosen/framebuffer");
-+	if (node < 0)
-+		return 0;
-+
-+	const char *name = fdt_get_name(fw_fdt, fw_node, NULL);
-+	if (!name)
-+		problem("could not get framebuffer name\n");
-+
-+	if (fdt_set_name(fdt, node, name))
-+		problem("could not set framebuffer name\n");
-+
-+	int len;
-+	const void *reg = fdt_getprop(fw_fdt, fw_node, "reg", &len);
-+	if (!reg)
-+		problem("could not get framebuffer reg property\n");
-+
-+	if (fdt_setprop(fdt, node, "reg", reg, len))
-+		problem("could not set framebuffer reg property\n");
-+
-+	const void *width = fdt_getprop(fw_fdt, fw_node, "width", &len);
-+	if (!width)
-+		problem("could not get framebuffer width property\n");
-+
-+	if (fdt_setprop(fdt, node, "width", width, len))
-+		problem("could not set framebuffer width property\n");
-+
-+	const void *height = fdt_getprop(fw_fdt, fw_node, "height", &len);
-+	if (!height)
-+		problem("could not get framebuffer height property\n");
-+
-+	if (fdt_setprop(fdt, node, "height", height, len))
-+		problem("could not set framebuffer height property\n");
-+
-+	const void *stride = fdt_getprop(fw_fdt, fw_node, "stride", &len);
-+	if (!stride)
-+		problem("could not get framebuffer stride property\n");
-+
-+	if (fdt_setprop(fdt, node, "stride", stride, len))
-+		problem("could not set framebuffer stride property\n");
-+
-+	const void *format = fdt_getprop(fw_fdt, fw_node, "format", &len);
-+	if (!format)
-+		problem("could not get framebuffer format property\n");
-+
-+	if (fdt_setprop(fdt, node, "format", format, len))
-+		problem("could not set framebuffer format property\n");
-+
-+	fdt_delprop(fdt, node, "status"); /* un-disable if disabled */
-+
-+	return 0;
-+}
-+
-+static int copy_mac_addresses(void *fdt, void *fw_fdt)
-+{
-+	int aliases = fdt_path_offset(fdt, "/aliases");
-+	if (aliases < 0)
-+		problem("aliases node missing\n");
-+
-+	int property;
-+	fdt_for_each_property_offset(property, fdt, aliases)
-+	{
-+		const char *if_name = (const char *)fdt_getprop_by_offset(
-+			fdt, property, NULL, NULL);
-+
-+		int node = fdt_path_offset(fdt, if_name);
-+		if (!fdt_getprop(fdt, node, "local-mac-address", NULL))
-+			continue; /* probably not a network interface */
-+
-+		int fw_node = fdt_path_offset(fw_fdt, if_name);
-+		if (fw_node < 0)
-+			problem("corresponding node for %s missing\n", if_name);
-+
-+		int len;
-+		const void *mac = fdt_getprop(fw_fdt, fw_node, "local-mac-address", &len);
-+		if (!mac)
-+			problem("could not get local-mac-address of %s\n", if_name);
-+
-+		if (fdt_setprop(fdt, node, "local-mac-address", mac, len))
-+			problem("could not set local-mac-address of %s\n", if_name);
-+	}
-+
-+	return 0;
-+}
-+
-+static int copy_disabled_status(void *fdt, void *fw_fdt)
-+{
-+	const char *soc_path = "/soc/";
-+	int fw_soc_node = fdt_path_offset(fw_fdt, soc_path);
-+	if (fw_soc_node < 0)
-+		problem("soc node missing from firmware\n");
-+
-+	char dev_path[64];
-+	strcpy(dev_path, soc_path);
-+	char *dev_name = dev_path + strlen(soc_path);
-+
-+	/* each time we do fdt_setprop, existing offsets could be invalidated, so
-+	we need to start over. this turns this function into O(n^3) probably, but
-+	there's only a few devices so it should be okay */
-+again: ;
-+
-+	int soc_node = fdt_path_offset(fdt, soc_path);
-+	if (soc_node < 0)
-+		problem("soc node missing\n");
-+
-+	int node;
-+	fdt_for_each_subnode(node, fdt, soc_node)
-+	{
-+		const char *name = fdt_get_name(fdt, node, NULL);
-+		if (strncmp(name, "i2c@", 4) && strncmp(name, "usb@", 4))
-+			continue;
-+
-+		const char *status = fdt_getprop(fdt, node, "status", NULL);
-+		if (status && !strcmp(status, "disabled"))
-+			continue;
-+
-+		strncpy(dev_name, name, dev_path+64-dev_name);
-+		dev_path[63] = '\0';
-+		int fw_node = fdt_path_offset(fw_fdt, dev_path);
-+		if (fw_node < 0)
-+			problem("corresponding node for %s missing\n", dev_path);
-+
-+		const char *fw_status = fdt_getprop(fw_fdt, fw_node, "status", NULL);
-+		if (!fw_status || strcmp(fw_status, "disabled"))
-+			continue;
-+
-+		int iommus_size;
-+		const char *iommus = fdt_getprop(fdt, node, "iommus", &iommus_size);
-+		if (iommus) {
-+			if (iommus_size & 7)
-+				problem("invalid iommus size for %s\n", dev_path);
-+
-+			for (int i = 0; i < iommus_size/8; i++) {
-+				u32 phandle = 0;
-+				phandle |= (iommus[i*8 + 0] << 24);
-+				phandle |= (iommus[i*8 + 1] << 16);
-+				phandle |= (iommus[i*8 + 2] << 8);
-+				phandle |= iommus[i*8 + 3];
-+
-+				int io_node;
-+				fdt_for_each_subnode(io_node, fdt, soc_node)
-+				{
-+					if (fdt_get_phandle(fdt, io_node) != phandle)
-+						continue;
-+
-+					const char *status = fdt_getprop(fdt, io_node, "status", NULL);
-+					if (status && !strcmp(status, "disabled"))
-+						continue;
-+
-+					if (fdt_setprop_string(fdt, io_node, "status", "disabled") < 0)
-+						problem("could not disable iommu %u\n", phandle);
-+
-+					goto again;
-+				}
-+			}
-+		}
-+
-+		if (fdt_setprop_string(fdt, node, "status", "disabled") < 0)
-+			problem("could not disable device %s\n", dev_path);
-+
-+		goto again;
-+	}
-+
-+	return 0;
-+}
-+
-+static int copy_cpu(void *fdt, void *fw_fdt)
-+{
-+	const char *cpus_path = "/cpus/";
-+	int fw_cpus_node = fdt_path_offset(fw_fdt, cpus_path);
-+	if (fw_cpus_node < 0)
-+		problem("cpus node missing from firmware\n");
-+
-+	char cpu_path[64];
-+	strcpy(cpu_path, cpus_path);
-+	char *cpu_name = cpu_path + strlen(cpus_path);
-+
-+	int cpus_node = fdt_path_offset(fdt, cpus_path);
-+	if (cpus_node < 0)
-+		problem("cpus node missing\n");
-+
-+	int node;
-+	fdt_for_each_subnode(node, fdt, cpus_node)
-+	{
-+		const char *name = fdt_get_name(fdt, node, NULL);
-+		if (strncmp(name, "cpu@", 4))
-+			continue;
-+
-+		strncpy(cpu_name, name, cpu_path+64-cpu_name);
-+		cpu_path[63] = '\0';
-+		int fw_node = fdt_path_offset(fw_fdt, cpu_path);
-+		if (fw_node < 0)
-+			problem("corresponding node for %s missing\n", cpu_path);
-+
-+		int len;
-+		const char *release_addr = fdt_getprop(
-+			fw_fdt, fw_node, "cpu-release-addr", &len);
-+		if (!release_addr)
-+			problem("could not get release addr of %s\n", cpu_path);
-+
-+		if (fdt_setprop(fdt, node, "cpu-release-addr", release_addr, len))
-+			problem("could not set release addr of %s\n", cpu_path);
-+	}
-+
-+	return 0;
-+}
-+
-+int apple_m1n1_update_fdt(void *fdt, void *fw_fdt)
-+{
-+	if (fdt == fw_fdt)
-+		return 0;
-+
-+	fdt_shrink_to_minimum(fdt, 4096);
-+
-+	int problems = 0;
-+	if (copy_mem(fdt, fw_fdt)) {
-+		printf("Could not copy memory information!\n");
-+		problems = 1;
-+	}
-+	if (copy_mem_rsv(fdt, fw_fdt)) {
-+		printf("Could not copy memory reservation information!\n");
-+		problems = 1;
-+	}
-+	if (copy_rng_seed(fdt, fw_fdt)) {
-+		printf("Could not copy RNG seed information!\n");
-+		problems = 1;
-+	}
-+	if (copy_framebuffer(fdt, fw_fdt)) {
-+		printf("Could not copy framebuffer information!\n");
-+		problems = 1;
-+	}
-+	if (copy_mac_addresses(fdt, fw_fdt)) {
-+		printf("Could not copy MAC address information!\n");
-+		problems = 1;
-+	}
-+	if (copy_disabled_status(fdt, fw_fdt)) {
-+		printf("Could not copy device disabled status information!\n");
-+		problems = 1;
-+	}
-+	if (copy_cpu(fdt, fw_fdt)) {
-+		printf("Could not copy CPU information!\n");
-+		problems = 1;
-+	}
-+
-+	if (problems)
-+	{
-+		printf("Something went wrong updating the loaded device tree.\n"
-+			"This might be cured by updating U-Boot's device tree, "
-+			"or m1n1 itself.\n");
-+	}
-+
-+	return 0;
-+}
diff --git a/nix/u-boot/default.nix b/nix/u-boot/default.nix
index 787c87a0b621..ba3c7fe57aab 100644
--- a/nix/u-boot/default.nix
+++ b/nix/u-boot/default.nix
@@ -20,10 +20,8 @@
     CONFIG_IDENT_STRING=" ${version} ${withDeviceTree}"
   '';
 }).overrideAttrs (o: {
-  patches = [
-    ./0001-m1n1-fdt-compat.patch
-    ./0001-add-extlinux-vars.patch
-  ];
+  # upstream patches are not applicable
+  patches = [ ];
 
   preInstall = ''
     cat ${m1n1}/build/m1n1.macho u-boot.dtb u-boot-nodtb.bin > u-boot.macho