Merge pull request #306385 from khaneliman/yabai
yabai: pkgs/os-specific -> pkgs/by-name
This commit is contained in:
commit
866b27e6ae
2 changed files with 67 additions and 59 deletions
|
@ -1,42 +1,51 @@
|
||||||
{ lib
|
{
|
||||||
, stdenv
|
lib,
|
||||||
, fetchFromGitHub
|
stdenv,
|
||||||
, fetchzip
|
overrideSDK,
|
||||||
, installShellFiles
|
fetchFromGitHub,
|
||||||
, testers
|
fetchzip,
|
||||||
, writeShellScript
|
installShellFiles,
|
||||||
, common-updater-scripts
|
testers,
|
||||||
, curl
|
writeShellScript,
|
||||||
, jq
|
common-updater-scripts,
|
||||||
, xcodebuild
|
curl,
|
||||||
, xxd
|
darwin,
|
||||||
, yabai
|
jq,
|
||||||
, Carbon
|
xcodebuild,
|
||||||
, Cocoa
|
xxd,
|
||||||
, ScriptingBridge
|
yabai,
|
||||||
, SkyLight
|
|
||||||
}:
|
}:
|
||||||
|
let
|
||||||
|
inherit (darwin.apple_sdk_11_0.frameworks)
|
||||||
|
Carbon
|
||||||
|
Cocoa
|
||||||
|
ScriptingBridge
|
||||||
|
SkyLight
|
||||||
|
;
|
||||||
|
|
||||||
stdenv.mkDerivation (finalAttrs: {
|
stdenv' = if stdenv.isDarwin then overrideSDK stdenv "11.0" else stdenv;
|
||||||
|
in
|
||||||
|
stdenv'.mkDerivation (finalAttrs: {
|
||||||
pname = "yabai";
|
pname = "yabai";
|
||||||
version = "7.1.0";
|
version = "7.1.0";
|
||||||
|
|
||||||
src = finalAttrs.passthru.sources.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
|
src =
|
||||||
|
finalAttrs.passthru.sources.${stdenv.hostPlatform.system}
|
||||||
|
or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
|
||||||
|
|
||||||
env = {
|
env = {
|
||||||
# silence service.h error
|
# silence service.h error
|
||||||
NIX_CFLAGS_COMPILE = "-Wno-implicit-function-declaration";
|
NIX_CFLAGS_COMPILE = "-Wno-implicit-function-declaration";
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs =
|
||||||
installShellFiles
|
[ installShellFiles ]
|
||||||
]
|
++ lib.optionals stdenv.isx86_64 [
|
||||||
++ lib.optionals stdenv.isx86_64 [
|
xcodebuild
|
||||||
xcodebuild
|
xxd
|
||||||
xxd
|
];
|
||||||
];
|
|
||||||
|
|
||||||
buildInputs = [ ] ++ lib.optionals stdenv.isx86_64 [
|
buildInputs = lib.optionals stdenv.isx86_64 [
|
||||||
Carbon
|
Carbon
|
||||||
Cocoa
|
Cocoa
|
||||||
ScriptingBridge
|
ScriptingBridge
|
||||||
|
@ -59,20 +68,22 @@ stdenv.mkDerivation (finalAttrs: {
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
postPatch = lib.optionalString stdenv.isx86_64 /* bash */ ''
|
postPatch =
|
||||||
# aarch64 code is compiled on all targets, which causes our Apple SDK headers to error out.
|
lib.optionalString stdenv.isx86_64 # bash
|
||||||
# Since multilib doesnt work on darwin i dont know of a better way of handling this.
|
''
|
||||||
substituteInPlace makefile \
|
# aarch64 code is compiled on all targets, which causes our Apple SDK headers to error out.
|
||||||
--replace "-arch arm64e" "" \
|
# Since multilib doesn't work on darwin i dont know of a better way of handling this.
|
||||||
--replace "-arch arm64" "" \
|
substituteInPlace makefile \
|
||||||
--replace "clang" "${stdenv.cc.targetPrefix}clang"
|
--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 arent packaged.
|
# `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 compiletime.
|
# 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
|
# https://github.com/koekeishiya/yabai/blob/v4.0.2/src/workspace.m#L109
|
||||||
substituteInPlace src/workspace.m \
|
substituteInPlace src/workspace.m \
|
||||||
--replace 'return screen.safeAreaInsets.top;' 'return 0;'
|
--replace 'return screen.safeAreaInsets.top;' 'return 0;'
|
||||||
'';
|
'';
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
tests.version = testers.testVersion {
|
tests.version = testers.testVersion {
|
||||||
|
@ -87,18 +98,23 @@ stdenv.mkDerivation (finalAttrs: {
|
||||||
url = "https://github.com/koekeishiya/yabai/releases/download/v${finalAttrs.version}/yabai-v${finalAttrs.version}.tar.gz";
|
url = "https://github.com/koekeishiya/yabai/releases/download/v${finalAttrs.version}/yabai-v${finalAttrs.version}.tar.gz";
|
||||||
hash = "sha256-88Sh2nizAQ0a0cnlnrkhb5x3VjHa372HhjHlmNjGdQ4=";
|
hash = "sha256-88Sh2nizAQ0a0cnlnrkhb5x3VjHa372HhjHlmNjGdQ4=";
|
||||||
};
|
};
|
||||||
"x86_64-darwin" = fetchFromGitHub
|
"x86_64-darwin" = fetchFromGitHub {
|
||||||
{
|
owner = "koekeishiya";
|
||||||
owner = "koekeishiya";
|
repo = "yabai";
|
||||||
repo = "yabai";
|
rev = "v${finalAttrs.version}";
|
||||||
rev = "v${finalAttrs.version}";
|
hash = "sha256-5iC1U6tyUYFLjOfnIxCrjCjj2deUZ/rvsJN4jlrr2Tc=";
|
||||||
hash = "sha256-5iC1U6tyUYFLjOfnIxCrjCjj2deUZ/rvsJN4jlrr2Tc=";
|
};
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
updateScript = writeShellScript "update-yabai" ''
|
updateScript = writeShellScript "update-yabai" ''
|
||||||
set -o errexit
|
set -o errexit
|
||||||
export PATH="${lib.makeBinPath [ curl jq common-updater-scripts ]}"
|
export PATH="${
|
||||||
|
lib.makeBinPath [
|
||||||
|
curl
|
||||||
|
jq
|
||||||
|
common-updater-scripts
|
||||||
|
]
|
||||||
|
}"
|
||||||
NEW_VERSION=$(curl --silent https://api.github.com/repos/koekeishiya/yabai/releases/latest | jq '.tag_name | ltrimstr("v")' --raw-output)
|
NEW_VERSION=$(curl --silent https://api.github.com/repos/koekeishiya/yabai/releases/latest | jq '.tag_name | ltrimstr("v")' --raw-output)
|
||||||
if [[ "${finalAttrs.version}" = "$NEW_VERSION" ]]; then
|
if [[ "${finalAttrs.version}" = "$NEW_VERSION" ]]; then
|
||||||
echo "The new version same as the old version."
|
echo "The new version same as the old version."
|
||||||
|
@ -130,12 +146,8 @@ stdenv.mkDerivation (finalAttrs: {
|
||||||
ivar
|
ivar
|
||||||
khaneliman
|
khaneliman
|
||||||
];
|
];
|
||||||
sourceProvenance = with lib.sourceTypes; [ ]
|
sourceProvenance =
|
||||||
++ lib.optionals stdenv.isx86_64 [
|
with lib.sourceTypes;
|
||||||
fromSource
|
lib.optionals stdenv.isx86_64 [ fromSource ] ++ lib.optionals stdenv.isAarch64 [ binaryNativeCode ];
|
||||||
] ++ lib.optionals stdenv.isAarch64 [
|
|
||||||
binaryNativeCode
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
|
@ -40707,10 +40707,6 @@ with pkgs;
|
||||||
|
|
||||||
xzoom = callPackage ../tools/X11/xzoom { };
|
xzoom = callPackage ../tools/X11/xzoom { };
|
||||||
|
|
||||||
yabai = darwin.apple_sdk_11_0.callPackage ../os-specific/darwin/yabai {
|
|
||||||
inherit (darwin.apple_sdk_11_0.frameworks) SkyLight Cocoa Carbon ScriptingBridge;
|
|
||||||
};
|
|
||||||
|
|
||||||
yacreader = libsForQt5.callPackage ../applications/graphics/yacreader { };
|
yacreader = libsForQt5.callPackage ../applications/graphics/yacreader { };
|
||||||
|
|
||||||
yadm = callPackage ../applications/version-management/yadm { };
|
yadm = callPackage ../applications/version-management/yadm { };
|
||||||
|
|
Loading…
Reference in a new issue