1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-18 11:40:45 +00:00

Merge pull request #203504 from IvarWithoutBones/bump-yabai

This commit is contained in:
Artturi 2023-01-03 23:52:03 +02:00 committed by GitHub
commit 099f6ed77c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 42 deletions

View file

@ -9,16 +9,16 @@
, yabai
, xxd
, xcodebuild
# These all need to be from SDK 11.0 or later starting with yabai 5.0.0
, Carbon
, Cocoa
, ScriptingBridge
# This needs to be from SDK 10.13 or higher, SLS APIs introduced in that version get used
, SkyLight
}:
let
pname = "yabai";
version = "4.0.4";
version = "5.0.2";
test-version = testers.testVersion {
package = yabai;
@ -52,7 +52,7 @@ in
src = fetchzip {
url = "https://github.com/koekeishiya/yabai/releases/download/v${version}/yabai-v${version}.tar.gz";
sha256 = "sha256-NS8tMUgovhWqc6WdkNI4wKee411i/e/OE++JVc86kFE=";
sha256 = "sha256-wL6N2+mfFISrOFn4zaCQI+oH6ixwUMRKRi1dAOigBro=";
};
nativeBuildInputs = [
@ -81,14 +81,14 @@ in
};
};
x86_64-darwin = stdenv.mkDerivation rec {
x86_64-darwin = stdenv.mkDerivation {
inherit pname version;
src = fetchFromGitHub {
owner = "koekeishiya";
repo = "yabai";
rev = "v${version}";
sha256 = "sha256-TeT+8UAV2jR60XvTs4phkp611Gi0nzLmQnezLA0xb44=";
sha256 = "sha256-/HS8TDzDA4Zvmm56ZZeMXyCKHRRTcucd7qDHT0qbrQg=";
};
nativeBuildInputs = [
@ -128,50 +128,15 @@ in
mkdir -p $out/{bin,share/icons/hicolor/scalable/apps}
cp ./bin/yabai $out/bin/yabai
ln -s ${loadScriptingAddition} $out/bin/yabai-load-sa
cp ./assets/icon/icon.svg $out/share/icons/hicolor/scalable/apps/yabai.svg
installManPage ./doc/yabai.1
runHook postInstall
'';
# Defining this here exposes it as a passthru attribute, which is useful because it allows us to run `builtins.hashFile` on it in pure-eval mode.
# With that we can programmatically generate an `/etc/sudoers.d` entry which disables the password requirement, so that a user-agent can run it at login.
loadScriptingAddition = writeShellScript "yabai-load-sa" ''
# For whatever reason the regular commands to load the scripting addition do not work, yabai will throw an error.
# The installation command mutably installs binaries to '/System', but then fails to start them. Manually running
# the bins as root does start the scripting addition, so this serves as a more user-friendly way to do that.
set -euo pipefail
if [[ "$EUID" != 0 ]]; then
echo "error: the scripting-addition loader must ran as root. try 'sudo $0'"
exit 1
fi
loaderPath="/Library/ScriptingAdditions/yabai.osax/Contents/MacOS/mach_loader";
if ! test -x "$loaderPath"; then
echo "could not locate the scripting-addition loader at '$loaderPath', installing it..."
echo "note: this may display an error"
eval "$(dirname "''${BASH_SOURCE[0]}")/yabai --install-sa" || true
sleep 1
fi
echo "executing loader..."
eval "$loaderPath"
echo "scripting-addition started"
'';
passthru.tests.version = test-version;
meta = _meta // {
longDescription = _meta.longDescription + ''
Note that due to a nix-only bug the scripting addition cannot be launched using the regular
procedure. Instead, you can use the provided `yabai-load-sa` script.
'';
sourceProvenance = with lib.sourceTypes; [
fromSource
];

View file

@ -37974,8 +37974,7 @@ with pkgs;
xzoom = callPackage ../tools/X11/xzoom {};
yabai = darwin.apple_sdk_11_0.callPackage ../os-specific/darwin/yabai {
inherit (darwin.apple_sdk.frameworks) Cocoa Carbon ScriptingBridge;
inherit (darwin.apple_sdk_11_0.frameworks) SkyLight;
inherit (darwin.apple_sdk_11_0.frameworks) SkyLight Cocoa Carbon ScriptingBridge;
};
yacreader = libsForQt5.callPackage ../applications/graphics/yacreader { };