# MacBook Pro (Apple Silicon, Asahi NixOS). Shared laptop options live in
# ../../modules/laptop.nix; only host-specific settings are here.
{ pkgs, ... }:

{
  imports = [
    ./hardware-configuration.nix
  ];

  # UEFI boot via systemd-boot. Asahi manages the EFI vars from macOS, so do not
  # touch them from NixOS.
  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = false;

  networking.hostName = "Lyra-Asahi";

  # Audio (PipeWire) and the swaylock PAM stack are inherited from
  # workstation.nix. hardware.enableRedistributableFirmware is also set there;
  # it is harmless here since Asahi supplies its own peripheral firmware below.

  # Binary cache for the Asahi kernel/build artifacts, so the MBP pulls prebuilt
  # outputs instead of compiling the Asahi kernel locally.
  nix.settings = {
    substituters = [ "https://nixos-apple-silicon.cachix.org" ];
    trusted-public-keys = [
      "nixos-apple-silicon.cachix.org-1:8psDu5SA5dAD7qA0zMy5UT292TxeEPzIz8VVEr2Js20="
    ];
  };

  # Apple peripheral firmware (Wi-Fi/Bluetooth). The directory is gitignored and
  # populated out-of-band -- see README.
  hardware.asahi.peripheralFirmwareDirectory = ../../modules/firmware;

  environment.systemPackages = with pkgs; [
    asahi-bless
    asahi-nvram
    asahi-btsync
    asahi-wifisync
    unzip
    ppp
    iptables
  ];

  # See `man configuration.nix` / the stateVersion docs before changing.
  system.stateVersion = "25.05";
}
