diff options
author | Alyssa Ross <hi@alyssa.is> | 2023-12-26 17:21:50 +0100 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2024-01-02 17:29:12 +0100 |
commit | 3a559792110a75c0a56c8cc21cc9e1353b27351f (patch) | |
tree | 7c8efd00586abedf7a11e3f089c6a9138f1046dc | |
parent | dd691ab6c1fabf1a4915cfe397a5b173e10f77af (diff) | |
parent | 9f81761270e6343d00b99d3e07e1feee8f3ba4b5 (diff) | |
download | nixlib-3a559792110a75c0a56c8cc21cc9e1353b27351f.tar nixlib-3a559792110a75c0a56c8cc21cc9e1353b27351f.tar.gz nixlib-3a559792110a75c0a56c8cc21cc9e1353b27351f.tar.bz2 nixlib-3a559792110a75c0a56c8cc21cc9e1353b27351f.tar.lz nixlib-3a559792110a75c0a56c8cc21cc9e1353b27351f.tar.xz nixlib-3a559792110a75c0a56c8cc21cc9e1353b27351f.tar.zst nixlib-3a559792110a75c0a56c8cc21cc9e1353b27351f.zip |
Merge https://github.com/tpwrules/nixos-apple-silicon
13 files changed, 302 insertions, 56 deletions
diff --git a/modules/nixos-apple-silicon/README.md b/modules/nixos-apple-silicon/README.md index d28cc7cb0972..7edeb907a0ac 100644 --- a/modules/nixos-apple-silicon/README.md +++ b/modules/nixos-apple-silicon/README.md @@ -9,7 +9,7 @@ Please see the documentation and guide below to get started. ## Documentation * [Release Notes](docs/release-notes.md) -* [Setup, Installation, and Maintenance Guide (2023-12-19)](docs/uefi-standalone.md) +* [Setup, Installation, and Maintenance Guide (2023-12-24)](docs/uefi-standalone.md) ## Credits diff --git a/modules/nixos-apple-silicon/apple-silicon-support/modules/sound/default.nix b/modules/nixos-apple-silicon/apple-silicon-support/modules/sound/default.nix index 5713f1aa18ec..e1b45a8dcbcf 100644 --- a/modules/nixos-apple-silicon/apple-silicon-support/modules/sound/default.nix +++ b/modules/nixos-apple-silicon/apple-silicon-support/modules/sound/default.nix @@ -1,20 +1,69 @@ { config, pkgs, lib, ... }: { + imports = [ + # disable pulseaudio as the Asahi sound infrastructure can't use it. + # if we disable it only if setupAsahiSound is enabled, then infinite + # recursion results as pulseaudio enables config.sound by default. + { config.hardware.pulseaudio.enable = false; } + ]; + options.hardware.asahi = { - setupAlsaUcm = lib.mkOption { + setupAsahiSound = lib.mkOption { type = lib.types.bool; default = config.sound.enable; description = '' - Enable the Asahi-specific ALSA UCM2 configs in the global environment - so that headphone jack input and output work properly. + Set up the Asahi DSP components so that the speakers and headphone jack + work properly and safely. ''; }; }; - config = lib.mkIf config.hardware.asahi.setupAlsaUcm { - environment.variables = { - ALSA_CONFIG_UCM2 = "${pkgs.alsa-ucm-conf-asahi}/share/alsa/ucm2"; + config = let + asahi-audio = pkgs.asahi-audio; # the asahi-audio we use + + lsp-plugins = pkgs.lsp-plugins; # the lsp-plugins we use + + lsp-plugins-is-patched = (lsp-plugins.overrideAttrs (old: { + passthru = (old.passthru or {}) // { + lsp-plugins-is-patched = builtins.elem "58c3f985f009c84347fa91236f164a9e47aafa93.patch" + (builtins.map (p: p.name) (old.patches or [])); + }; + })).lsp-plugins-is-patched; + + lsp-plugins-is-safe = (pkgs.lib.versionAtLeast lsp-plugins.version "1.2.14") || lsp-plugins-is-patched; + in lib.mkIf config.hardware.asahi.setupAsahiSound { + # enable pipewire to run real-time and avoid audible glitches + security.rtkit.enable = true; + # set up pipewire with the supported capabilities (instead of pulseaudio) + services.pipewire = { + enable = true; + + alsa.enable = true; + wireplumber.enable = true; + pulse.enable = true; }; + + # enable speakersafetyd to protect speakers + systemd.packages = lib.mkAssert lsp-plugins-is-safe + "lsp-plugins is unpatched/outdated and speakers cannot be safely enabled" + [ pkgs.speakersafetyd ]; + services.udev.packages = [ pkgs.speakersafetyd ]; + + # set up enivronment so that asahi-audio and UCM configs are used + environment.etc = builtins.listToAttrs (builtins.map + (f: { name = f; value = { source = "${asahi-audio}/share/${f}"; }; }) + asahi-audio.providedConfigFiles); + environment.variables.ALSA_CONFIG_UCM2 = "${pkgs.alsa-ucm-conf-asahi}/share/alsa/ucm2"; + + # set up pipewire and wireplumber to use asahi-audio configs and plugins + systemd.user.services.pipewire.environment.ALSA_CONFIG_UCM2 = config.environment.variables.ALSA_CONFIG_UCM2; + systemd.user.services.wireplumber.environment.ALSA_CONFIG_UCM2 = config.environment.variables.ALSA_CONFIG_UCM2; + systemd.user.services.pipewire.environment.LV2_PATH = let + lv2Plugins = [ lsp-plugins pkgs.bankstown-lv2 ]; + in lib.makeSearchPath "lib/lv2" lv2Plugins; + systemd.user.services.wireplumber.environment.LV2_PATH = let + lv2Plugins = [ lsp-plugins pkgs.bankstown-lv2 ]; + in lib.makeSearchPath "lib/lv2" lv2Plugins; }; } diff --git a/modules/nixos-apple-silicon/apple-silicon-support/packages/asahi-audio/default.nix b/modules/nixos-apple-silicon/apple-silicon-support/packages/asahi-audio/default.nix new file mode 100644 index 000000000000..4ccbcc5d066c --- /dev/null +++ b/modules/nixos-apple-silicon/apple-silicon-support/packages/asahi-audio/default.nix @@ -0,0 +1,51 @@ +{ stdenv +, lib +, fetchFromGitHub +}: + +stdenv.mkDerivation rec { + pname = "asahi-audio"; + # tracking: https://src.fedoraproject.org/rpms/asahi-audio + # note: ensure that the providedConfigFiles list below is current! + version = "1.6"; + + src = fetchFromGitHub { + owner = "AsahiLinux"; + repo = "asahi-audio"; + rev = "v${version}"; + hash = "sha256-NxTQD742U2FUZNmw7RHuOruMuTRLtAh1HDlMV9EzQkg="; + }; + + preBuild = '' + export PREFIX=$out + + readarray -t configs < <(\ + find . \ + -name '*.conf' -or \ + -name '*.json' -or \ + -name '*.lua' + ) + + substituteInPlace "''${configs[@]}" --replace \ + "/usr/share/asahi-audio" \ + "$out/asahi-audio" + ''; + + postInstall = '' + # no need to link the asahi-audio dir globally + mv $out/share/asahi-audio $out + ''; + + # list of config files installed in $out/share/ and destined for + # /etc/, from the `install -pm0644 conf/` lines in the Makefile. note + # that the contents of asahi-audio/ stay in $out/ and the config files + # are modified to point to them. + passthru.providedConfigFiles = [ + "wireplumber/wireplumber.conf.d/99-asahi.conf" + "wireplumber/policy.lua.d/85-asahi-policy.lua" + "wireplumber/main.lua.d/85-asahi.lua" + "wireplumber/scripts/policy-asahi.lua" + "pipewire/pipewire.conf.d/99-asahi.conf" + "pipewire/pipewire-pulse.conf.d/99-asahi.conf" + ]; +} diff --git a/modules/nixos-apple-silicon/apple-silicon-support/packages/bankstown-lv2/default.nix b/modules/nixos-apple-silicon/apple-silicon-support/packages/bankstown-lv2/default.nix new file mode 100644 index 000000000000..275019bf1acb --- /dev/null +++ b/modules/nixos-apple-silicon/apple-silicon-support/packages/bankstown-lv2/default.nix @@ -0,0 +1,38 @@ +{ lib +, lv2 +, pkg-config +, rustPlatform +, fetchFromGitHub +, fetchpatch +}: + +rustPlatform.buildRustPackage rec { + pname = "bankstown-lv2"; + # tracking: https://src.fedoraproject.org/rpms/rust-bankstown-lv2 + version = "1.0.3"; + + src = fetchFromGitHub { + owner = "chadmed"; + repo = "bankstown"; + rev = version; + hash = "sha256-dPgQuwwY1FEsH65vYClTtV/c+0cB5uq8QYszeHPdIQA="; + }; + + cargoSha256 = "sha256-HIW4mJ1VQSzOIksmJ2d4FQjTfU2Zk6xva1mYUk6MQCI="; + + installPhase = '' + export LIBDIR=$out/lib + mkdir -p $LIBDIR + + make + make install + ''; + + nativeBuildInputs = [ + pkg-config + ]; + + buildInputs = [ + lv2 + ]; +} diff --git a/modules/nixos-apple-silicon/apple-silicon-support/packages/linux-asahi/config b/modules/nixos-apple-silicon/apple-silicon-support/packages/linux-asahi/config index 37294fd976bc..6fd5630b89cb 100644 --- a/modules/nixos-apple-silicon/apple-silicon-support/packages/linux-asahi/config +++ b/modules/nixos-apple-silicon/apple-silicon-support/packages/linux-asahi/config @@ -1,4 +1,4 @@ -# from https://github.com/AsahiLinux/PKGBUILDs/blob/main/linux-asahi/config +# originally from https://github.com/AsahiLinux/PKGBUILDs/blob/main/linux-asahi/config # note that this file is not passed to the kernel verbatim, it is parsed and run through `make config`, so stuff below like compiler version will be automatically adjusted for NixOS # @@ -273,7 +273,6 @@ CONFIG_PERF_EVENTS=y CONFIG_SYSTEM_DATA_VERIFICATION=y CONFIG_PROFILING=y -CONFIG_RUST=y CONFIG_RUSTC_VERSION_TEXT="rustc 1.72.1 (d5c2e9c34 2023-09-13) (Arch Linux rust 1:1.72.1-1)" CONFIG_BINDGEN_VERSION_TEXT="bindgen 0.68.1" # end of General setup @@ -553,7 +552,6 @@ CONFIG_DT_IDLE_GENPD=y # CONFIG_ARM_PSCI_CPUIDLE=y CONFIG_ARM_PSCI_CPUIDLE_DOMAIN=y -CONFIG_ARM_APPLE_CPUIDLE=y # end of ARM CPU Idle Drivers # end of CPU Idle @@ -3153,7 +3151,6 @@ CONFIG_INPUT_PWM_VIBRA=m # CONFIG_INPUT_DRV260X_HAPTICS is not set # CONFIG_INPUT_DRV2665_HAPTICS is not set # CONFIG_INPUT_DRV2667_HAPTICS is not set -CONFIG_INPUT_MACSMC_HID=m # CONFIG_RMI4_CORE is not set # @@ -3346,7 +3343,6 @@ CONFIG_SPI_MEM=y # SPI Master Controller Drivers # # CONFIG_SPI_ALTERA is not set -CONFIG_SPI_APPLE=m # CONFIG_SPI_AXI_SPI_ENGINE is not set # CONFIG_SPI_BITBANG is not set # CONFIG_SPI_CADENCE is not set @@ -3386,7 +3382,6 @@ CONFIG_SPI_SPIDEV=m CONFIG_SPI_DYNAMIC=y CONFIG_SPMI=y # CONFIG_SPMI_HISI3670 is not set -CONFIG_SPMI_APPLE=m # CONFIG_HSI is not set CONFIG_PPS=y # CONFIG_PPS_DEBUG is not set @@ -3481,7 +3476,6 @@ CONFIG_GPIO_CDEV_V1=y # # MFD GPIO expanders # -CONFIG_GPIO_MACSMC=m # end of MFD GPIO expanders # @@ -3524,7 +3518,6 @@ CONFIG_POWER_RESET=y # CONFIG_POWER_RESET_BRCMSTB is not set # CONFIG_POWER_RESET_GPIO is not set # CONFIG_POWER_RESET_GPIO_RESTART is not set -CONFIG_POWER_RESET_MACSMC=m # CONFIG_POWER_RESET_LTC2952 is not set # CONFIG_POWER_RESET_REGULATOR is not set # CONFIG_POWER_RESET_RESTART is not set @@ -3577,7 +3570,6 @@ CONFIG_POWER_SUPPLY_HWMON=y # CONFIG_CHARGER_UCS1002 is not set # CONFIG_CHARGER_BD99954 is not set # CONFIG_BATTERY_UG3105 is not set -CONFIG_CHARGER_MACSMC=m CONFIG_HWMON=y # CONFIG_HWMON_DEBUG_CHIP is not set @@ -3814,7 +3806,6 @@ CONFIG_BCMA_POSSIBLE=y # CONFIG_MFD_CORE=m # CONFIG_MFD_ACT8945A is not set -CONFIG_MFD_APPLE_SPMI_PMU=m # CONFIG_MFD_AS3711 is not set # CONFIG_MFD_SMPRO is not set # CONFIG_MFD_AS3722 is not set @@ -4316,7 +4307,6 @@ CONFIG_V4L_MEM2MEM_DRIVERS=y # # Apple media platform drivers # -CONFIG_VIDEO_APPLE_ISP=m # # Aspeed media platform drivers @@ -4870,7 +4860,6 @@ CONFIG_DRM_LOAD_EDID_FIRMWARE=y CONFIG_DRM_TTM=y CONFIG_DRM_VRAM_HELPER=y CONFIG_DRM_TTM_HELPER=y -CONFIG_DRM_GEM_SHMEM_HELPER=y # # I2C encoder or helper chips @@ -4894,7 +4883,6 @@ CONFIG_DRM_GEM_SHMEM_HELPER=y # CONFIG_DRM_NOUVEAU is not set CONFIG_DRM_VGEM=y # CONFIG_DRM_VKMS is not set -# CONFIG_DRM_ASAHI is not set # CONFIG_DRM_VMWGFX is not set # CONFIG_DRM_UDL is not set # CONFIG_DRM_AST is not set @@ -4996,7 +4984,6 @@ CONFIG_DRM_BOCHS=y # CONFIG_DRM_GM12U320 is not set # CONFIG_DRM_PANEL_MIPI_DBI is not set CONFIG_DRM_SIMPLEDRM=y -# CONFIG_DRM_SIMPLEDRM_BACKLIGHT is not set # CONFIG_TINYDRM_HX8357D is not set # CONFIG_TINYDRM_ILI9163 is not set # CONFIG_TINYDRM_ILI9225 is not set @@ -5010,10 +4997,8 @@ CONFIG_DRM_SIMPLEDRM=y # CONFIG_DRM_LIMA is not set # CONFIG_DRM_PANFROST is not set # CONFIG_DRM_TIDSS is not set -# CONFIG_DRM_ADP is not set # CONFIG_DRM_GUD is not set # CONFIG_DRM_SSD130X is not set -# CONFIG_DRM_APPLE is not set # CONFIG_DRM_LEGACY is not set CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y @@ -5210,7 +5195,6 @@ CONFIG_SND_SOC_COMPRESS=y # CONFIG_SND_SOC_AMD_ACP is not set # CONFIG_SND_AMD_ACP_CONFIG is not set CONFIG_SND_SOC_APPLE_MCA=m -CONFIG_SND_SOC_APPLE_MACAUDIO=m # CONFIG_SND_ATMEL_SOC is not set # CONFIG_SND_BCM63XX_I2S_WHISTLER is not set # CONFIG_SND_DESIGNWARE_I2S is not set @@ -5622,7 +5606,6 @@ CONFIG_I2C_HID=y # # SPI HID support # -CONFIG_SPI_HID_APPLE_OF=m # end of SPI HID support CONFIG_SPI_HID_APPLE_CORE=m @@ -5630,7 +5613,6 @@ CONFIG_SPI_HID_APPLE_CORE=m # # DockChannel HID support # -CONFIG_HID_DOCKCHANNEL=m # end of DockChannel HID support CONFIG_USB_OHCI_LITTLE_ENDIAN=y @@ -5666,7 +5648,6 @@ CONFIG_USB_XHCI_HCD=m # CONFIG_USB_XHCI_DBGCAP is not set CONFIG_USB_XHCI_PCI=m # CONFIG_USB_XHCI_PCI_RENESAS is not set -CONFIG_USB_XHCI_PCI_ASMEDIA=y CONFIG_USB_XHCI_PLATFORM=m # CONFIG_USB_EHCI_HCD is not set # CONFIG_USB_OXU210HP_HCD is not set @@ -6252,7 +6233,6 @@ CONFIG_RTC_I2C_AND_SPI=y # HID Sensor RTC drivers # # CONFIG_RTC_DRV_GOLDFISH is not set -CONFIG_RTC_DRV_MACSMC=m CONFIG_DMADEVICES=y # CONFIG_DMADEVICES_DEBUG is not set @@ -6394,9 +6374,6 @@ CONFIG_STAGING_MEDIA=y # CONFIG_CHROME_PLATFORMS is not set # CONFIG_MELLANOX_PLATFORM is not set # CONFIG_SURFACE_PLATFORMS is not set -CONFIG_APPLE_PLATFORMS=y -CONFIG_APPLE_SMC=m -CONFIG_APPLE_SMC_RTKIT=m CONFIG_HAVE_CLK=y CONFIG_HAVE_CLK_PREPARE=y CONFIG_COMMON_CLK=y @@ -6498,12 +6475,7 @@ CONFIG_APPLE_DART=m # Apple SoC drivers # CONFIG_APPLE_PMGR_PWRSTATE=y -CONFIG_APPLE_PMGR_MISC=y -CONFIG_APPLE_MBOX=m -CONFIG_APPLE_RTKIT=m -CONFIG_APPLE_RTKIT_HELPER=m CONFIG_APPLE_SART=m -CONFIG_APPLE_DOCKCHANNEL=m # end of Apple SoC drivers # @@ -6618,7 +6590,6 @@ CONFIG_RESET_CONTROLLER=y # CONFIG_GENERIC_PHY=y # CONFIG_PHY_CAN_TRANSCEIVER is not set -CONFIG_PHY_APPLE_ATC=m # # PHY drivers for Broadcom platforms @@ -6685,7 +6656,6 @@ CONFIG_NVMEM_SYSFS=y CONFIG_NVMEM_APPLE_EFUSES=m # CONFIG_NVMEM_RMEM is not set -CONFIG_NVMEM_SPMI_MFD=m # CONFIG_NVMEM_SPMI_SDAM is not set # CONFIG_NVMEM_U_BOOT_ENV is not set @@ -7801,9 +7771,6 @@ CONFIG_ARCH_USE_MEMTEST=y # # Rust hacking # -# CONFIG_RUST_DEBUG_ASSERTIONS is not set -CONFIG_RUST_OVERFLOW_CHECKS=y -# CONFIG_RUST_BUILD_ASSERT_ALLOW is not set # end of Rust hacking # end of Kernel hacking @@ -7815,3 +7782,58 @@ CONFIG_ACPI=y CONFIG_TCG_TPM=y CONFIG_TCG_TIS=m CONFIG_TCG_CRB=m + +# Fedora Asahi Remix-specific options +# generated with something like +# git diff --name-only fedora-6.6 fedora-asahi-6.6 redhat/configs/ | xargs cat >> config +# in a checkout of https://gitlab.com/fedora-asahi/kernel-asahi/-/tree/fedora-asahi-6.6 + +# CONFIG_APPLE_PLATFORMS is not set +# CONFIG_DRM_SIMPLEDRM_BACKLIGHT is not set +CONFIG_RUST=y +# CONFIG_RUST_BUILD_ASSERT_ALLOW is not set +# CONFIG_RUST_DEBUG_ASSERTIONS is not set +# CONFIG_RUST_EXTRA_LOCKDEP is not set +CONFIG_RUST_OVERFLOW_CHECKS=y +# CONFIG_SPI_HID_APPLE_OF is not set +# CONFIG_USB_XHCI_PCI_ASMEDIA is not set +# CONFIG_APPLE_MAILBOX is not set +# CONFIG_APPLE_PMGR_MISC is not set +CONFIG_ARM64_MEMORY_MODEL_CONTROL=y +# CONFIG_ARM_APPLE_CPUIDLE is not set +# CONFIG_SND_SOC_CS42L84 is not set +CONFIG_DRM_GEM_SHMEM_HELPER=y +CONFIG_USB_XHCI_PCI_ASMEDIA=y +CONFIG_SND_SOC_CS42L84=m +CONFIG_TOUCHSCREEN_APPLE_Z2=m +CONFIG_APPLE_DOCKCHANNEL=m +CONFIG_APPLE_MBOX=y +CONFIG_APPLE_PLATFORMS=y +CONFIG_APPLE_PMGR_MISC=y +CONFIG_APPLE_RTKIT=y +CONFIG_APPLE_RTKIT_HELPER=m +CONFIG_APPLE_SMC=m +CONFIG_APPLE_SMC_RTKIT=m +CONFIG_ARM_APPLE_CPUIDLE=y +CONFIG_CHARGER_MACSMC=m +CONFIG_DRM_ADP=m +CONFIG_DRM_APPLE=m +CONFIG_DRM_ASAHI=m +# CONFIG_DRM_ASAHI_DEBUG_ALLOCATOR is not set +CONFIG_GPIO_MACSMC=m +CONFIG_HID_DOCKCHANNEL=m +CONFIG_INPUT_MACSMC_HID=m +CONFIG_MFD_APPLE_SPMI_PMU=m +CONFIG_MUX_APPLE_DPXBAR=m +CONFIG_NVMEM_SPMI_MFD=m +CONFIG_PHY_APPLE_ATC=m +CONFIG_PHY_APPLE_DPTX=m +CONFIG_POWER_RESET_MACSMC=m +CONFIG_RTC_DRV_MACSMC=m +CONFIG_SND_SOC_APPLE_MACAUDIO=m +CONFIG_SND_SOC_APPLE_SILICON=m +CONFIG_SPI_APPLE=m +CONFIG_SPI_HID_APPLE_OF=m +CONFIG_SPMI_APPLE=m +CONFIG_VIDEO_APPLE_ISP=m +CONFIG_SND_SOC_CS42L84=m diff --git a/modules/nixos-apple-silicon/apple-silicon-support/packages/linux-asahi/default.nix b/modules/nixos-apple-silicon/apple-silicon-support/packages/linux-asahi/default.nix index a582aac81b8f..88f75df29b84 100644 --- a/modules/nixos-apple-silicon/apple-silicon-support/packages/linux-asahi/default.nix +++ b/modules/nixos-apple-silicon/apple-silicon-support/packages/linux-asahi/default.nix @@ -101,6 +101,20 @@ let }; kernelPatches = [ + # speaker enablement; we assert on the relevant lsp-plugins patch + # before installing speakersafetyd to let the speakers work + { name = "speakers-1"; + patch = fetchpatch { + url = "https://github.com/AsahiLinux/linux/commit/385ea7b5023486aba7919cec8b6b3f6a843a1013.patch"; + hash = "sha256-u7IzhJbUgBPfhJXAcpHw1I6OPzPHc1UKYjH91Ep3QHQ="; + }; + } + { name = "speakers-2"; + patch = fetchpatch { + url = "https://github.com/AsahiLinux/linux/commit/6a24102c06c95951ab992e2d41336cc6d4bfdf23.patch"; + hash = "sha256-wn5x2hN42/kCp/XHBvLWeNLfwlOBB+T6UeeMt2tSg3o="; + }; + } ] ++ lib.optionals _4KBuild [ # thanks to Sven Peter # https://lore.kernel.org/linux-iommu/20211019163737.46269-1-sven@svenpeter.dev/ diff --git a/modules/nixos-apple-silicon/apple-silicon-support/packages/overlay.nix b/modules/nixos-apple-silicon/apple-silicon-support/packages/overlay.nix index 982d9081fcab..3d9d5ff79c35 100644 --- a/modules/nixos-apple-silicon/apple-silicon-support/packages/overlay.nix +++ b/modules/nixos-apple-silicon/apple-silicon-support/packages/overlay.nix @@ -5,4 +5,7 @@ final: prev: { asahi-fwextract = final.callPackage ./asahi-fwextract { }; mesa-asahi-edge = final.callPackage ./mesa-asahi-edge { inherit (prev) mesa; }; alsa-ucm-conf-asahi = final.callPackage ./alsa-ucm-conf-asahi { inherit (prev) alsa-ucm-conf; }; + speakersafetyd = final.callPackage ./speakersafetyd { }; + bankstown-lv2 = final.callPackage ./bankstown-lv2 { }; + asahi-audio = final.callPackage ./asahi-audio { }; } diff --git a/modules/nixos-apple-silicon/apple-silicon-support/packages/speakersafetyd/default.nix b/modules/nixos-apple-silicon/apple-silicon-support/packages/speakersafetyd/default.nix new file mode 100644 index 000000000000..bce0af1162f9 --- /dev/null +++ b/modules/nixos-apple-silicon/apple-silicon-support/packages/speakersafetyd/default.nix @@ -0,0 +1,36 @@ +{ rustPlatform +, stdenv +, rust +, fetchCrate +, pkg-config +, alsa-lib +}: + +rustPlatform.buildRustPackage rec { + pname = "speakersafetyd"; + # tracking: https://src.fedoraproject.org/rpms/rust-speakersafetyd + version = "0.1.9"; + + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ alsa-lib ]; + + src = fetchCrate { + inherit pname version; + hash = "sha256-I1fL1U4vqKxPS1t6vujMTdi/JAAOCcPkvUqv6FqkId4="; + }; + cargoHash = "sha256-Adwct+qFhUsOIao8XqNK2zcn13DBlQNA+X4aRFeIAXM="; + + postPatch = '' + substituteInPlace speakersafetyd.service --replace "/usr" "$out" + substituteInPlace Makefile --replace "target/release" "target/${rust.lib.toRustTargetSpec stdenv.hostPlatform}/$cargoBuildType" + ''; + + installFlags = [ + "DESTDIR=${placeholder "out"}" + "BINDIR=/bin" + "SHAREDIR=/share" + "TMPFILESDIR=/lib/tmpfiles.d" + ]; + + dontCargoInstall = true; +} diff --git a/modules/nixos-apple-silicon/docs/release-notes.md b/modules/nixos-apple-silicon/docs/release-notes.md index d7bd23b821d7..c96466a809f4 100644 --- a/modules/nixos-apple-silicon/docs/release-notes.md +++ b/modules/nixos-apple-silicon/docs/release-notes.md @@ -2,6 +2,46 @@ This file contains important information for each release. +## 2023-12-24 + +This release updates nixpkgs. + +This release changes how the Asahi configurations are loaded into PipeWire and +WirePlumber, thus making it possible for users to install other configurations +in parallel for e.g. Bluetooth (or override the Asahi configurations, though +this is likely a bad idea). Thanks to cid-chan for reporting this problem. + +## 2023-12-23 + +This release does not update any packages. + +This release corrects an oversight in the sound support which resulted in the +Asahi configurations not being loaded properly into PipeWire and WirePlumber. +This is now fixed, and audio quality and behavior should be at the +upstream-intended standard. Thanks to ivabus for reporting this oversight. + +Additionally, rtkit is enabled by default to allow the audio components to run +at real-time priority and so reduce glitches. + +## 2023-12-22 + +This release updates nixpkgs and includes the necessary components for full +sound support, namely speakersafetyd, bankstown-lv2, and asahi-audio. + +New features and fixes: +* Full speaker and headphone support is finally here! (on supported machines and + nixpkgs versions) + * You will need at least `sound.enable = true;` in your configuration. + * Sound support relies on PipeWire, which is automatically enabled by the + apple-silicon-support module. You must remove any + `hardware.pulseaudio.enable = true;` from your configuration, or building + it will fail. PipeWire's PulseAudio compatibility module is enabled by + default. + * Thanks to yu-re-ka and diamondburned for helping with this support. +* Kernel config is now synced with and will track Fedora Asahi Remix's Apple + Silicon-specific changes + * This fixes a missing option which broke GPU acceleration on M2 hardware. + ## 2023-12-19 This release updates nixpkgs, m1n1, U-Boot, the kernel, and Mesa. diff --git a/modules/nixos-apple-silicon/docs/uefi-standalone.md b/modules/nixos-apple-silicon/docs/uefi-standalone.md index 1209027cced7..f8e911721a9b 100644 --- a/modules/nixos-apple-silicon/docs/uefi-standalone.md +++ b/modules/nixos-apple-silicon/docs/uefi-standalone.md @@ -1,11 +1,11 @@ -# UEFI Boot Standalone NixOS (2023-12-19) +# UEFI Boot Standalone NixOS (2023-12-24) This guide will build and was tested with the following software: * Asahi Linux kernel version 6.6.0-asahi14 * Asahi Linux's Mesa version 24.0.0_asahi-20231213-1 * m1n1 version v1.4.11 * Asahi Linux's U-Boot version 2023.07.02.asahi4-1 -* Nixpkgs, as of 2023-12-17 +* Nixpkgs, as of 2023-12-22 * macOS stub 12.3 NOTE: The latest version of this guide will always be [at its home](https://github.com/tpwrules/nixos-apple-silicon/blob/main/docs/uefi-standalone.md). For more general information about Linux on Apple Silicon Macs, refer to the [Asahi Linux project](https://asahilinux.org/) and [alpha installer release](https://asahilinux.org/2022/03/asahi-linux-alpha-release/). diff --git a/modules/nixos-apple-silicon/flake.lock b/modules/nixos-apple-silicon/flake.lock index 14e9ea6b16b7..a7500c64ee28 100644 --- a/modules/nixos-apple-silicon/flake.lock +++ b/modules/nixos-apple-silicon/flake.lock @@ -17,17 +17,17 @@ }, "nixpkgs": { "locked": { - "lastModified": 1702830618, - "narHash": "sha256-lvhwIvRwhOLgzbRuYkqHy4M5cQHYs4ktL6/hyuBS6II=", + "lastModified": 1703255338, + "narHash": "sha256-Z6wfYJQKmDN9xciTwU3cOiOk+NElxdZwy/FiHctCzjU=", "owner": "nixos", "repo": "nixpkgs", - "rev": "91a00709aebb3602f172a0bf47ba1ef013e34835", + "rev": "6df37dc6a77654682fe9f071c62b4242b5342e04", "type": "github" }, "original": { "owner": "nixos", "repo": "nixpkgs", - "rev": "91a00709aebb3602f172a0bf47ba1ef013e34835", + "rev": "6df37dc6a77654682fe9f071c62b4242b5342e04", "type": "github" } }, diff --git a/modules/nixos-apple-silicon/flake.nix b/modules/nixos-apple-silicon/flake.nix index cb6e1724ae38..1f650bdb70b6 100644 --- a/modules/nixos-apple-silicon/flake.nix +++ b/modules/nixos-apple-silicon/flake.nix @@ -5,7 +5,7 @@ nixpkgs = { # https://hydra.nixos.org/jobset/mobile-nixos/unstable/evals # these evals have a cross-compiled stdenv available - url = "github:nixos/nixpkgs/91a00709aebb3602f172a0bf47ba1ef013e34835"; + url = "github:nixos/nixpkgs/6df37dc6a77654682fe9f071c62b4242b5342e04"; }; rust-overlay = { @@ -46,6 +46,7 @@ }; in { inherit (pkgs) m1n1 uboot-asahi linux-asahi asahi-fwextract mesa-asahi-edge; + inherit (pkgs) speakersafetyd bankstown-lv2 asahi-audio; installer-bootstrap = let diff --git a/modules/nixos-apple-silicon/iso-configuration/installer-configuration.nix b/modules/nixos-apple-silicon/iso-configuration/installer-configuration.nix index 39c9ae90efcf..0cd3ca711e77 100644 --- a/modules/nixos-apple-silicon/iso-configuration/installer-configuration.nix +++ b/modules/nixos-apple-silicon/iso-configuration/installer-configuration.nix @@ -107,14 +107,6 @@ util-linux = prev.util-linux.override { translateManpages = false; }; - - # documentation cross-compilation is currently broken - # https://github.com/NixOS/nixpkgs/pull/275078 - btrfs-progs = prev.btrfs-progs.overrideAttrs (old: { - configureFlags = (old.configureFlags or []) ++ [ - "--disable-documentation" - ]; - }); }) ]; |