Skip to content

Commit 6549112

Browse files
authored
yabai: refactor new sdk pattern; switch to apple-sdk_15; 7.1.4 -> 7.1.5 (#352621)
2 parents 981216b + af9131f commit 6549112

File tree

1 file changed

+15
-45
lines changed

1 file changed

+15
-45
lines changed

pkgs/by-name/ya/yabai/package.nix

Lines changed: 15 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,33 @@
11
{
22
lib,
33
stdenv,
4-
overrideSDK,
54
fetchFromGitHub,
65
fetchzip,
7-
installShellFiles,
8-
testers,
9-
writeShellScript,
6+
apple-sdk_15,
107
common-updater-scripts,
118
curl,
12-
darwin,
9+
installShellFiles,
1310
jq,
14-
xcodebuild,
11+
versionCheckHook,
12+
writeShellScript,
1513
xxd,
16-
yabai,
1714
}:
18-
let
19-
inherit (darwin.apple_sdk_11_0.frameworks)
20-
Carbon
21-
Cocoa
22-
ScriptingBridge
23-
SkyLight
24-
;
25-
26-
stdenv' = if stdenv.hostPlatform.isDarwin then overrideSDK stdenv "11.0" else stdenv;
27-
in
28-
stdenv'.mkDerivation (finalAttrs: {
15+
stdenv.mkDerivation (finalAttrs: {
2916
pname = "yabai";
30-
version = "7.1.4";
17+
version = "7.1.5";
3118

3219
src =
3320
finalAttrs.passthru.sources.${stdenv.hostPlatform.system}
3421
or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
3522

36-
env = {
37-
# silence service.h error
38-
NIX_CFLAGS_COMPILE = "-Wno-implicit-function-declaration";
39-
};
40-
4123
nativeBuildInputs =
4224
[ installShellFiles ]
4325
++ lib.optionals stdenv.hostPlatform.isx86_64 [
44-
xcodebuild
4526
xxd
4627
];
4728

4829
buildInputs = lib.optionals stdenv.hostPlatform.isx86_64 [
49-
Carbon
50-
Cocoa
51-
ScriptingBridge
52-
SkyLight
30+
apple-sdk_15
5331
];
5432

5533
dontConfigure = true;
@@ -74,35 +52,27 @@ stdenv'.mkDerivation (finalAttrs: {
7452
# aarch64 code is compiled on all targets, which causes our Apple SDK headers to error out.
7553
# Since multilib doesn't work on darwin i dont know of a better way of handling this.
7654
substituteInPlace makefile \
77-
--replace "-arch arm64e" "" \
78-
--replace "-arch arm64" "" \
79-
--replace "clang" "${stdenv.cc.targetPrefix}clang"
80-
81-
# `NSScreen::safeAreaInsets` is only available on macOS 12.0 and above, which frameworks aren't packaged.
82-
# When a lower OS version is detected upstream just returns 0, so we can hardcode that at compile time.
83-
# https://github.com/koekeishiya/yabai/blob/v4.0.2/src/workspace.m#L109
84-
substituteInPlace src/workspace.m \
85-
--replace 'return screen.safeAreaInsets.top;' 'return 0;'
55+
--replace-fail "-arch arm64e" "" \
56+
--replace-fail "-arch arm64" ""
8657
'';
8758

88-
passthru = {
89-
tests.version = testers.testVersion {
90-
package = yabai;
91-
version = "yabai-v${finalAttrs.version}";
92-
};
59+
nativeInstallCheckInputs = [ versionCheckHook ];
60+
versionCheckProgramArg = "--version";
61+
doInstallCheck = true;
9362

63+
passthru = {
9464
sources = {
9565
# Unfortunately compiling yabai from source on aarch64-darwin is a bit complicated. We use the precompiled binary instead for now.
9666
# See the comments on https://github.com/NixOS/nixpkgs/pull/188322 for more information.
9767
"aarch64-darwin" = fetchzip {
9868
url = "https://github.com/koekeishiya/yabai/releases/download/v${finalAttrs.version}/yabai-v${finalAttrs.version}.tar.gz";
99-
hash = "sha256-DAHZwEhPIBIfR2V+jTKje1msB8OMKzwGYgYnDql8zb0=";
69+
hash = "sha256-o+9Z3Kxo1ff1TZPmmE6ptdOSsruQzxZm59bdYvhRo3c=";
10070
};
10171
"x86_64-darwin" = fetchFromGitHub {
10272
owner = "koekeishiya";
10373
repo = "yabai";
10474
rev = "v${finalAttrs.version}";
105-
hash = "sha256-i/UqmBNTLBYY4ORI1Y7FWr+LZK0f/qMdWLPPuTb9+2w=";
75+
hash = "sha256-6HBWJvjVWagtHrfjWaYSRcnQOuwTBVeVxo3wc+jSlyE=";
10676
};
10777
};
10878

0 commit comments

Comments
 (0)