diff options
author | Alyssa Ross <hi@alyssa.is> | 2024-03-01 11:38:33 +0100 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2024-03-01 11:38:33 +0100 |
commit | 66f707d69f1e423db5a35c2fe43b32781125a9af (patch) | |
tree | df143385065f8e2bfa232e2d7297193158d59892 /modules | |
parent | e05a4d9a87f3ff3bdf8114ac5a340ad0063f1c73 (diff) | |
parent | 9ccf1cb93bdaa96294598bef8a7ffaa72226b0fb (diff) | |
download | nixlib-66f707d69f1e423db5a35c2fe43b32781125a9af.tar nixlib-66f707d69f1e423db5a35c2fe43b32781125a9af.tar.gz nixlib-66f707d69f1e423db5a35c2fe43b32781125a9af.tar.bz2 nixlib-66f707d69f1e423db5a35c2fe43b32781125a9af.tar.lz nixlib-66f707d69f1e423db5a35c2fe43b32781125a9af.tar.xz nixlib-66f707d69f1e423db5a35c2fe43b32781125a9af.tar.zst nixlib-66f707d69f1e423db5a35c2fe43b32781125a9af.zip |
Merge https://github.com/tpwrules/nixos-apple-silicon
Diffstat (limited to 'modules')
8 files changed, 82 insertions, 32 deletions
diff --git a/modules/nixos-apple-silicon/README.md b/modules/nixos-apple-silicon/README.md index 1ef3dd39caea..93b9f6fa1907 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 (2024-02-26)](docs/uefi-standalone.md) +* [Setup, Installation, and Maintenance Guide (2024-02-29)](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 98b111237d61..38e412b9e174 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,4 +1,4 @@ -{ config, pkgs, lib, ... }: +{ config, options, pkgs, lib, ... }: { imports = [ @@ -32,34 +32,57 @@ })).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) - # and asahi-audio configs and plugins - services.pipewire = { - enable = true; - configPackages = [ asahi-audio ]; - extraLv2Packages = [ lsp-plugins pkgs.bankstown-lv2 ]; - alsa.enable = true; - pulse.enable = true; - wireplumber = { + # https://github.com/NixOS/nixpkgs/pull/282377 + # options is the set of all module option declarations, rather than their + # values, to prevent infinite recursion + newHotness = builtins.hasAttr "configPackages" options.services.pipewire; + + lv2Path = lib.makeSearchPath "lib/lv2" [ lsp-plugins pkgs.bankstown-lv2 ]; + in lib.mkIf config.hardware.asahi.setupAsahiSound (lib.mkMerge [ + { + # enable pipewire to run real-time and avoid audible glitches + security.rtkit.enable = true; + # set up pipewire with the supported capabilities (instead of pulseaudio) + # and asahi-audio configs and plugins + services.pipewire = { enable = true; + + alsa.enable = true; + pulse.enable = true; + wireplumber.enable = true; + }; + + # set up enivronment so that UCM configs are used as well + environment.variables.ALSA_CONFIG_UCM2 = "${pkgs.alsa-ucm-conf-asahi}/share/alsa/ucm2"; + 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; + + # 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 ]; + } + (lib.optionalAttrs newHotness { + # use configPackages and friends to install asahi-audio and plugins + services.pipewire = { configPackages = [ asahi-audio ]; extraLv2Packages = [ lsp-plugins pkgs.bankstown-lv2 ]; + wireplumber = { + configPackages = [ asahi-audio ]; + extraLv2Packages = [ lsp-plugins pkgs.bankstown-lv2 ]; + }; }; - }; + }) + (lib.optionalAttrs (!newHotness) { + # use environment.etc and environment variables to install asahi-audio and plugins + environment.etc = builtins.listToAttrs (builtins.map + (f: { name = f; value = { source = "${asahi-audio}/share/${f}"; }; }) + asahi-audio.providedConfigFiles); - # set up enivronment so that UCM configs are used as well - environment.variables.ALSA_CONFIG_UCM2 = "${pkgs.alsa-ucm-conf-asahi}/share/alsa/ucm2"; - 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; - - # 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 ]; - }; + systemd.user.services.pipewire.environment.LV2_PATH = lv2Path; + systemd.user.services.wireplumber.environment.LV2_PATH = lv2Path; + }) + ]); } 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 index d54c26cb299f..4ccbcc5d066c 100644 --- 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 @@ -6,6 +6,7 @@ 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 { @@ -34,4 +35,17 @@ stdenv.mkDerivation rec { # 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/docs/release-notes.md b/modules/nixos-apple-silicon/docs/release-notes.md index 251fe6cc9b49..5f0ba4a0033b 100644 --- a/modules/nixos-apple-silicon/docs/release-notes.md +++ b/modules/nixos-apple-silicon/docs/release-notes.md @@ -2,6 +2,16 @@ This file contains important information for each release. +## 2024-02-29 + +This release updates nixpkgs. + +This release corrects a few minor issues: +* Resolves an error that flakes were not enabled when running `nixos-install` +* Updates to avoid using a nixpkgs version that was not from the nixos-unstable + channel +* Restored compatibility for the sound module with older versions of nixpkgs. + ## 2024-02-26 This release updates nixpkgs, the kernel, and Mesa. Thanks to oliverbestmann for diff --git a/modules/nixos-apple-silicon/docs/uefi-standalone.md b/modules/nixos-apple-silicon/docs/uefi-standalone.md index 20d926e17c91..49bc96ccdc67 100644 --- a/modules/nixos-apple-silicon/docs/uefi-standalone.md +++ b/modules/nixos-apple-silicon/docs/uefi-standalone.md @@ -1,4 +1,4 @@ -# UEFI Boot Standalone NixOS (2024-02-26) +# UEFI Boot Standalone NixOS (2024-02-29) This guide will build and was tested with the following software: * Asahi Linux kernel version 6.6.0-asahi15 diff --git a/modules/nixos-apple-silicon/flake.lock b/modules/nixos-apple-silicon/flake.lock index 65246b664331..770b3c493737 100644 --- a/modules/nixos-apple-silicon/flake.lock +++ b/modules/nixos-apple-silicon/flake.lock @@ -17,17 +17,17 @@ }, "nixpkgs": { "locked": { - "lastModified": 1708954320, - "narHash": "sha256-n3LXNMlz7ORCjfIrIUo19a844Fec2+yg7k6NspdVCxs=", + "lastModified": 1708984720, + "narHash": "sha256-gJctErLbXx4QZBBbGp78PxtOOzsDaQ+yw1ylNQBuSUY=", "owner": "nixos", "repo": "nixpkgs", - "rev": "94cda73bf2fd675de987db7c3ac81e861b892266", + "rev": "13aff9b34cc32e59d35c62ac9356e4a41198a538", "type": "github" }, "original": { "owner": "nixos", "repo": "nixpkgs", - "rev": "94cda73bf2fd675de987db7c3ac81e861b892266", + "rev": "13aff9b34cc32e59d35c62ac9356e4a41198a538", "type": "github" } }, diff --git a/modules/nixos-apple-silicon/flake.nix b/modules/nixos-apple-silicon/flake.nix index af65ca715bb4..5a02396bc94d 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/94cda73bf2fd675de987db7c3ac81e861b892266"; + url = "github:nixos/nixpkgs/13aff9b34cc32e59d35c62ac9356e4a41198a538"; }; rust-overlay = { diff --git a/modules/nixos-apple-silicon/iso-configuration/installer-configuration.nix b/modules/nixos-apple-silicon/iso-configuration/installer-configuration.nix index 112ce6e3cf89..2e2410aa4679 100644 --- a/modules/nixos-apple-silicon/iso-configuration/installer-configuration.nix +++ b/modules/nixos-apple-silicon/iso-configuration/installer-configuration.nix @@ -123,6 +123,9 @@ PROGRAM ${pkgs.coreutils}/bin/true ''; + # bogus warning when referring to <nixpkgs> + nix.settings.experimental-features = [ "flakes" ]; + # get rid of warning that stateVersion is unset system.stateVersion = lib.mkDefault lib.trivial.release; } |