From 4457d955d01a4f8e0187448063e146bc36e4745f Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Thu, 31 Oct 2024 09:36:52 -0500 Subject: [PATCH 1/5] yabai: refactor to new sdk pattern --- pkgs/by-name/ya/yabai/package.nix | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/pkgs/by-name/ya/yabai/package.nix b/pkgs/by-name/ya/yabai/package.nix index 53834f3cd739..5b3fab50ad70 100644 --- a/pkgs/by-name/ya/yabai/package.nix +++ b/pkgs/by-name/ya/yabai/package.nix @@ -1,7 +1,6 @@ { lib, stdenv, - overrideSDK, fetchFromGitHub, fetchzip, installShellFiles, @@ -9,23 +8,12 @@ writeShellScript, common-updater-scripts, curl, - darwin, jq, - xcodebuild, xxd, yabai, + apple-sdk_11, }: -let - inherit (darwin.apple_sdk_11_0.frameworks) - Carbon - Cocoa - ScriptingBridge - SkyLight - ; - - stdenv' = if stdenv.hostPlatform.isDarwin then overrideSDK stdenv "11.0" else stdenv; -in -stdenv'.mkDerivation (finalAttrs: { +stdenv.mkDerivation (finalAttrs: { pname = "yabai"; version = "7.1.4"; @@ -41,15 +29,11 @@ stdenv'.mkDerivation (finalAttrs: { nativeBuildInputs = [ installShellFiles ] ++ lib.optionals stdenv.hostPlatform.isx86_64 [ - xcodebuild xxd ]; buildInputs = lib.optionals stdenv.hostPlatform.isx86_64 [ - Carbon - Cocoa - ScriptingBridge - SkyLight + apple-sdk_11 ]; dontConfigure = true; From 88eb0fcca4d46cb4f2211394b213d6175add582e Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Thu, 31 Oct 2024 10:32:30 -0500 Subject: [PATCH 2/5] yabai: switch to apple-sdk_15 Upstream uses __builtin._available checks for sdk features. We can leverage the newer sdk to make sure we keep up with new features as they are added since they are careful with version checks. --- pkgs/by-name/ya/yabai/package.nix | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/pkgs/by-name/ya/yabai/package.nix b/pkgs/by-name/ya/yabai/package.nix index 5b3fab50ad70..8d2375576b46 100644 --- a/pkgs/by-name/ya/yabai/package.nix +++ b/pkgs/by-name/ya/yabai/package.nix @@ -11,7 +11,7 @@ jq, xxd, yabai, - apple-sdk_11, + apple-sdk_15, }: stdenv.mkDerivation (finalAttrs: { pname = "yabai"; @@ -33,7 +33,7 @@ stdenv.mkDerivation (finalAttrs: { ]; buildInputs = lib.optionals stdenv.hostPlatform.isx86_64 [ - apple-sdk_11 + apple-sdk_15 ]; dontConfigure = true; @@ -58,15 +58,9 @@ stdenv.mkDerivation (finalAttrs: { # aarch64 code is compiled on all targets, which causes our Apple SDK headers to error out. # Since multilib doesn't work on darwin i dont know of a better way of handling this. substituteInPlace makefile \ - --replace "-arch arm64e" "" \ - --replace "-arch arm64" "" \ - --replace "clang" "${stdenv.cc.targetPrefix}clang" - - # `NSScreen::safeAreaInsets` is only available on macOS 12.0 and above, which frameworks aren't packaged. - # When a lower OS version is detected upstream just returns 0, so we can hardcode that at compile time. - # https://github.com/koekeishiya/yabai/blob/v4.0.2/src/workspace.m#L109 - substituteInPlace src/workspace.m \ - --replace 'return screen.safeAreaInsets.top;' 'return 0;' + --replace-fail "-arch arm64e" "" \ + --replace-fail "-arch arm64" "" \ + --replace-fail "clang" "${stdenv.cc.targetPrefix}clang" ''; passthru = { From b2607dee162817714049169785310ea52684cb0f Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Sat, 2 Nov 2024 12:33:20 -0500 Subject: [PATCH 3/5] yabai: add versionCheckHook --- pkgs/by-name/ya/yabai/package.nix | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/pkgs/by-name/ya/yabai/package.nix b/pkgs/by-name/ya/yabai/package.nix index 8d2375576b46..c2386ab526d7 100644 --- a/pkgs/by-name/ya/yabai/package.nix +++ b/pkgs/by-name/ya/yabai/package.nix @@ -3,15 +3,14 @@ stdenv, fetchFromGitHub, fetchzip, - installShellFiles, - testers, - writeShellScript, + apple-sdk_15, common-updater-scripts, curl, + installShellFiles, jq, + versionCheckHook, + writeShellScript, xxd, - yabai, - apple-sdk_15, }: stdenv.mkDerivation (finalAttrs: { pname = "yabai"; @@ -63,12 +62,11 @@ stdenv.mkDerivation (finalAttrs: { --replace-fail "clang" "${stdenv.cc.targetPrefix}clang" ''; - passthru = { - tests.version = testers.testVersion { - package = yabai; - version = "yabai-v${finalAttrs.version}"; - }; + nativeInstallCheckInputs = [ versionCheckHook ]; + versionCheckProgramArg = "--version"; + doInstallCheck = true; + passthru = { sources = { # Unfortunately compiling yabai from source on aarch64-darwin is a bit complicated. We use the precompiled binary instead for now. # See the comments on https://github.com/NixOS/nixpkgs/pull/188322 for more information. From 550d4a2af43d74f0fded665f01f3b4651af835d7 Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Sat, 2 Nov 2024 12:34:46 -0500 Subject: [PATCH 4/5] yabai: modernize --- pkgs/by-name/ya/yabai/package.nix | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/pkgs/by-name/ya/yabai/package.nix b/pkgs/by-name/ya/yabai/package.nix index c2386ab526d7..89b6f4fe197c 100644 --- a/pkgs/by-name/ya/yabai/package.nix +++ b/pkgs/by-name/ya/yabai/package.nix @@ -20,11 +20,6 @@ stdenv.mkDerivation (finalAttrs: { finalAttrs.passthru.sources.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}"); - env = { - # silence service.h error - NIX_CFLAGS_COMPILE = "-Wno-implicit-function-declaration"; - }; - nativeBuildInputs = [ installShellFiles ] ++ lib.optionals stdenv.hostPlatform.isx86_64 [ @@ -58,8 +53,7 @@ stdenv.mkDerivation (finalAttrs: { # Since multilib doesn't work on darwin i dont know of a better way of handling this. substituteInPlace makefile \ --replace-fail "-arch arm64e" "" \ - --replace-fail "-arch arm64" "" \ - --replace-fail "clang" "${stdenv.cc.targetPrefix}clang" + --replace-fail "-arch arm64" "" ''; nativeInstallCheckInputs = [ versionCheckHook ]; From af9131fa6de1bd184ad5e8d20a4034c425d3b7d2 Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Sat, 2 Nov 2024 12:36:13 -0500 Subject: [PATCH 5/5] yabai: 7.1.4 -> 7.1.5 --- pkgs/by-name/ya/yabai/package.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/ya/yabai/package.nix b/pkgs/by-name/ya/yabai/package.nix index 89b6f4fe197c..451fd71fff88 100644 --- a/pkgs/by-name/ya/yabai/package.nix +++ b/pkgs/by-name/ya/yabai/package.nix @@ -14,7 +14,7 @@ }: stdenv.mkDerivation (finalAttrs: { pname = "yabai"; - version = "7.1.4"; + version = "7.1.5"; src = finalAttrs.passthru.sources.${stdenv.hostPlatform.system} @@ -66,13 +66,13 @@ stdenv.mkDerivation (finalAttrs: { # See the comments on https://github.com/NixOS/nixpkgs/pull/188322 for more information. "aarch64-darwin" = fetchzip { url = "https://github.com/koekeishiya/yabai/releases/download/v${finalAttrs.version}/yabai-v${finalAttrs.version}.tar.gz"; - hash = "sha256-DAHZwEhPIBIfR2V+jTKje1msB8OMKzwGYgYnDql8zb0="; + hash = "sha256-o+9Z3Kxo1ff1TZPmmE6ptdOSsruQzxZm59bdYvhRo3c="; }; "x86_64-darwin" = fetchFromGitHub { owner = "koekeishiya"; repo = "yabai"; rev = "v${finalAttrs.version}"; - hash = "sha256-i/UqmBNTLBYY4ORI1Y7FWr+LZK0f/qMdWLPPuTb9+2w="; + hash = "sha256-6HBWJvjVWagtHrfjWaYSRcnQOuwTBVeVxo3wc+jSlyE="; }; };