switchaudio-osx: init at 1.2.2

+72
+25
pkgs/by-name/sw/switchaudio-osx/001-macos-legacy-support.patch
··· 1 + From 02803f510bae37eac88b0168ff887bdf7d71a7f0 Mon Sep 17 00:00:00 2001 2 + From: James Woglom <j@wogloms.net> 3 + Date: Wed, 1 May 2024 00:36:14 -0400 4 + Subject: [PATCH] Fix build when run on pre-macOS Monterey 5 + 6 + --- 7 + audio_switch.c | 4 ++++ 8 + 1 file changed, 4 insertions(+) 9 + 10 + diff --git a/audio_switch.c b/audio_switch.c 11 + index 814edce..a064c3e 100644 12 + --- a/audio_switch.c 13 + +++ b/audio_switch.c 14 + @@ -715,7 +715,11 @@ OSStatus setMute(ASDeviceType typeRequested, ASMuteType muteRequested) { 15 + AudioObjectPropertyAddress propertyAddress = { 16 + .mSelector = kAudioDevicePropertyMute, 17 + .mScope = scope, 18 + + #ifndef MAC_OS_VERSION_12_0 19 + + .mElement = kAudioObjectPropertyElementMaster, 20 + + #else 21 + .mElement = kAudioObjectPropertyElementMain, 22 + + #endif 23 + }; 24 + 25 + UInt32 muted = (UInt32)muteRequested;
+47
pkgs/by-name/sw/switchaudio-osx/package.nix
··· 1 + { 2 + lib, 3 + stdenv, 4 + fetchFromGitHub, 5 + xcodebuild, 6 + xcbuildHook, 7 + }: 8 + 9 + stdenv.mkDerivation rec { 10 + pname = "switchaudio-osx"; 11 + version = "1.2.2"; 12 + 13 + src = fetchFromGitHub { 14 + owner = "deweller"; 15 + repo = "switchaudio-osx"; 16 + tag = version; 17 + hash = "sha256-AZJn5kHK/al94ONfIHcG+W0jyMfgdJkIngN+PVj+I44="; 18 + }; 19 + 20 + buildInputs = [ xcodebuild ]; 21 + 22 + nativeBuildInputs = [ xcbuildHook ]; 23 + 24 + patches = [ 25 + # Patch to fix running on earlier version of macOS 26 + # https://github.com/deweller/switchaudio-osx/pull/65 27 + ./001-macos-legacy-support.patch 28 + ]; 29 + 30 + installPhase = '' 31 + runHook preInstall 32 + 33 + # for some reason binary is located in Products/ rather than in build/ 34 + install -Dm755 Products/Release/SwitchAudioSource $out/bin/SwitchAudioSource 35 + 36 + runHook postInstall 37 + ''; 38 + 39 + meta = { 40 + description = "Command-line utility to manage audio input/output devices on macOS"; 41 + homepage = "https://github.com/deweller/switchaudio-osx"; 42 + mainProgram = "SwitchAudioSource"; 43 + license = lib.licenses.mit; 44 + maintainers = with lib.maintainers; [ taranarmo ]; 45 + platforms = lib.platforms.darwin; 46 + }; 47 + }