Loading pkgs/by-name/sw/switchaudio-osx/001-macos-legacy-support.patch 0 → 100644 +25 −0 Original line number Diff line number Diff line From 02803f510bae37eac88b0168ff887bdf7d71a7f0 Mon Sep 17 00:00:00 2001 From: James Woglom <j@wogloms.net> Date: Wed, 1 May 2024 00:36:14 -0400 Subject: [PATCH] Fix build when run on pre-macOS Monterey --- audio_switch.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/audio_switch.c b/audio_switch.c index 814edce..a064c3e 100644 --- a/audio_switch.c +++ b/audio_switch.c @@ -715,7 +715,11 @@ OSStatus setMute(ASDeviceType typeRequested, ASMuteType muteRequested) { AudioObjectPropertyAddress propertyAddress = { .mSelector = kAudioDevicePropertyMute, .mScope = scope, + #ifndef MAC_OS_VERSION_12_0 + .mElement = kAudioObjectPropertyElementMaster, + #else .mElement = kAudioObjectPropertyElementMain, + #endif }; UInt32 muted = (UInt32)muteRequested; No newline at end of file pkgs/by-name/sw/switchaudio-osx/package.nix 0 → 100644 +47 −0 Original line number Diff line number Diff line { lib, stdenv, fetchFromGitHub, xcodebuild, xcbuildHook, }: stdenv.mkDerivation rec { pname = "switchaudio-osx"; version = "1.2.2"; src = fetchFromGitHub { owner = "deweller"; repo = "switchaudio-osx"; tag = version; hash = "sha256-AZJn5kHK/al94ONfIHcG+W0jyMfgdJkIngN+PVj+I44="; }; buildInputs = [ xcodebuild ]; nativeBuildInputs = [ xcbuildHook ]; patches = [ # Patch to fix running on earlier version of macOS # https://github.com/deweller/switchaudio-osx/pull/65 ./001-macos-legacy-support.patch ]; installPhase = '' runHook preInstall # for some reason binary is located in Products/ rather than in build/ install -Dm755 Products/Release/SwitchAudioSource $out/bin/SwitchAudioSource runHook postInstall ''; meta = { description = "Command-line utility to manage audio input/output devices on macOS"; homepage = "https://github.com/deweller/switchaudio-osx"; mainProgram = "SwitchAudioSource"; license = lib.licenses.mit; maintainers = with lib.maintainers; [ taranarmo ]; platforms = lib.platforms.darwin; }; } Loading
pkgs/by-name/sw/switchaudio-osx/001-macos-legacy-support.patch 0 → 100644 +25 −0 Original line number Diff line number Diff line From 02803f510bae37eac88b0168ff887bdf7d71a7f0 Mon Sep 17 00:00:00 2001 From: James Woglom <j@wogloms.net> Date: Wed, 1 May 2024 00:36:14 -0400 Subject: [PATCH] Fix build when run on pre-macOS Monterey --- audio_switch.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/audio_switch.c b/audio_switch.c index 814edce..a064c3e 100644 --- a/audio_switch.c +++ b/audio_switch.c @@ -715,7 +715,11 @@ OSStatus setMute(ASDeviceType typeRequested, ASMuteType muteRequested) { AudioObjectPropertyAddress propertyAddress = { .mSelector = kAudioDevicePropertyMute, .mScope = scope, + #ifndef MAC_OS_VERSION_12_0 + .mElement = kAudioObjectPropertyElementMaster, + #else .mElement = kAudioObjectPropertyElementMain, + #endif }; UInt32 muted = (UInt32)muteRequested; No newline at end of file
pkgs/by-name/sw/switchaudio-osx/package.nix 0 → 100644 +47 −0 Original line number Diff line number Diff line { lib, stdenv, fetchFromGitHub, xcodebuild, xcbuildHook, }: stdenv.mkDerivation rec { pname = "switchaudio-osx"; version = "1.2.2"; src = fetchFromGitHub { owner = "deweller"; repo = "switchaudio-osx"; tag = version; hash = "sha256-AZJn5kHK/al94ONfIHcG+W0jyMfgdJkIngN+PVj+I44="; }; buildInputs = [ xcodebuild ]; nativeBuildInputs = [ xcbuildHook ]; patches = [ # Patch to fix running on earlier version of macOS # https://github.com/deweller/switchaudio-osx/pull/65 ./001-macos-legacy-support.patch ]; installPhase = '' runHook preInstall # for some reason binary is located in Products/ rather than in build/ install -Dm755 Products/Release/SwitchAudioSource $out/bin/SwitchAudioSource runHook postInstall ''; meta = { description = "Command-line utility to manage audio input/output devices on macOS"; homepage = "https://github.com/deweller/switchaudio-osx"; mainProgram = "SwitchAudioSource"; license = lib.licenses.mit; maintainers = with lib.maintainers; [ taranarmo ]; platforms = lib.platforms.darwin; }; }