tpwrules / nixos-apple-silicon

Resources to install NixOS bare metal on Apple Silicon Macs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rustc update still breaks build

vxld100 opened this issue · comments

I saw that there was the same issue 2 weeks ago, and apparently its closed, but I installed today with the latest release, and when referencing <apple-silicon-support/apple-silicon-support> and adding the channel, the rebuild fails, with exactly the same errors. As per default I am on nixos-unstable.

Guys, please. I now even tried this but it doesn't work either. I have no clue what the fuck to do now. I am stuck not really being able to rebuild my system properly.

I just tried and I can rebuild my system using the current release + the current nixpkgs-unstable.

You can always reference an older nixpkgs from when the last release was. There is no reason to force yourself to be on the most recent nixpkgs.

Can't believe we have a 'it works on my machine' moment on nixos. What exactly are you doing? Are you referencing the channels in your configuration.nix? Because I could build my system too with the 'current release of nixos for apple silicon' as long as I was referencing the local files. But since I started referencing the channels (the official one or the temp-fix one), it doesn't work anymore. I can't even go back to referencing local files.

I'm basically using the most simple bare bones config and no flakes. Flakes are a nightmare imo. I ran sudo nix-channel --update and then called ``sudo nixos-rebuild build`.

This is my config stripped of mostly irrelevant program configuration:

# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).

{ config, lib, pkgs, ... }:

{
  imports =
    [ # Include the results of the hardware scan.
      ./hardware-configuration.nix
      ./nixos-apple-silicon/apple-silicon-support
    ];

  hardware.asahi = {
    withRust = true;
    addEdgeKernelConfig = true;
    useExperimentalGPUDriver = true;
    experimentalGPUInstallMode = "replace";
  };
   
  sound.enable = true;
  hardware.opengl.enable = true;

  # Use the systemd-boot EFI boot loader.
  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = false;
  
  nixpkgs.config.allowUnfree = true;

  nix.package = pkgs.nixFlakes;

  nix.extraOptions = ''
    auto-optimise-store = true
    experimental-features = nix-command flakes
  '';

  users.users."rowan.goemans" = {
    isNormalUser = true;
    extraGroups = [
      "systemd-journal"
      "video"
      "audio"
      "dialout"
      "sudo"
    ];
  };

  programs.hyprland = {
    enable = true;
    xwayland.enable = true;
  };

  networking = {
    hostName = "rowanG-nixos";
    networkmanager.enable = true;
    networkmanager.wifi.backend = "iwd";
    firewall = {
      enable = true;
    };
  };

  powerManagement.cpuFreqGovernor = "performance";

  # Enable the X11 windowing system.
  services = {
    xserver = {
      enable = true;
      layout = "us";
      xkbOptions = "eurosign:e";
      dpi = 140;

      displayManager.sddm.enable = true;
    };
    
    pipewire = {
      enable = true;
      alsa.enable = true;
      alsa.support32Bit = true;
      pulse.enable = true;
    };
    # required for nm-applet?
    dbus.packages = [ pkgs.gcr ];
  };

  security.rtkit.enable = true;

  i18n.defaultLocale = "en_US.UTF-8";
  console = {
    font = "Lat2-Terminus16";
    keyMap = "us";
  };

  systemd.services.limit-charge = {
    enable = true;
    description = "limit charge to 80%";
    wantedBy = [ "multi-user.target" ];
    serviceConfig = {
      User = "root";
      Group = "root";
    };
    script = ''
      ${pkgs.coreutils}/bin/echo 80 > /sys/class/power_supply/macsmc-battery/charge_control_end_threshold
    '';
  };

  time.timeZone = "Europe/Amsterdam";

  environment.sessionVariables = {
    # If your cursor becomes invisible
    # WLR_NO_HARDWARE_CURSORS = "1";
    # Hint electron apps to use wayland
    NIXOS_OZONE_WL = "1";
  };

  environment.systemPackages = with pkgs; [
    ...
  ];

  xdg.portal = {
    enable = true;
    extraPortals = with pkgs; [
      xdg-desktop-portal-wlr
      xdg-desktop-portal-kde
      xdg-desktop-portal-gtk
    ];
  };
  # 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 = "23.11"; # Did you read the comment?
}

That PR looks like it only builds the kernel with that patch when withRust is enabled:

rustAtLeast = version: withRust && (lib.versionAtLeast rustc.version version);

It seems like something isn't quite right with how that patch is integrated.

@vxld100 Can you try with hardware.asahi.withRust = true;?

@rowanG077 yes, this is what I mean with referencing local files. What I'm doing is referencing the channels. Referencing local files worked for me too out of the box.

Thank you @noneucat. Yes, when enabling that option the config builds. I am not 100% sure it works as intended, for the system then fails to boot (using both the official apple-silicon-support or the temp-fix channel). However, I am not quite sure what the cause of that is... Should I enable some more options? Where are those hardware.asahi options documented?

The only thing that allows me to build a bootable system is using the temp-fix channel for apple silicon support with nixos-23.11, even though that forced me to ditch systemdboot (which was buggy anyways).

Are you sure there is not a conflict between system channels and user channels?

I personally put this repo's apple-silicon-support directory in my /etc/nixos and avoid the channel system.

@tpwrules I am not sure actually. But I really like the idea of referencing the channels and not some local files so that the updates can come in more easily. This is particularly useful for the apple-silicon support software, for every update can bring entirely new features, and so it's nice to have them ASAP.