commit
17583652e9
|
@ -4,9 +4,13 @@
|
|||
, fetchzip
|
||||
, installShellFiles
|
||||
, testers
|
||||
, yabai
|
||||
, xxd
|
||||
, writeShellScript
|
||||
, common-updater-scripts
|
||||
, curl
|
||||
, jq
|
||||
, xcodebuild
|
||||
, xxd
|
||||
, yabai
|
||||
, Carbon
|
||||
, Cocoa
|
||||
, ScriptingBridge
|
||||
|
@ -15,24 +19,9 @@
|
|||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "yabai";
|
||||
version = "7.0.2";
|
||||
version = "7.0.3";
|
||||
|
||||
src =
|
||||
# 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.
|
||||
if stdenv.isAarch64 then
|
||||
(fetchzip {
|
||||
url = "https://github.com/koekeishiya/yabai/releases/download/v${finalAttrs.version}/yabai-v${finalAttrs.version}.tar.gz";
|
||||
hash = "sha256-FeNiJJM5vdzFT9s7N9cTjLYxKEfzZnKE9br13lkQhJo=";
|
||||
})
|
||||
else if stdenv.isx86_64 then
|
||||
(fetchFromGitHub {
|
||||
owner = "koekeishiya";
|
||||
repo = "yabai";
|
||||
rev = "v${finalAttrs.version}";
|
||||
hash = "sha256-/MOAKsY7MlRWdvUQwHeITTeGJbCUdX7blZZAl2zXuic=";
|
||||
})
|
||||
else (throw "Unsupported system: ${stdenv.hostPlatform.system}");
|
||||
src = finalAttrs.passthru.sources.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
|
||||
|
||||
env = {
|
||||
# silence service.h error
|
||||
|
@ -85,9 +74,41 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
--replace 'return screen.safeAreaInsets.top;' 'return 0;'
|
||||
'';
|
||||
|
||||
passthru.tests.version = testers.testVersion {
|
||||
package = yabai;
|
||||
version = "yabai-v${finalAttrs.version}";
|
||||
passthru = {
|
||||
tests.version = testers.testVersion {
|
||||
package = yabai;
|
||||
version = "yabai-v${finalAttrs.version}";
|
||||
};
|
||||
|
||||
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.
|
||||
"aarch64-darwin" = fetchzip {
|
||||
url = "https://github.com/koekeishiya/yabai/releases/download/v${finalAttrs.version}/yabai-v${finalAttrs.version}.tar.gz";
|
||||
hash = "sha256-EvtKYYjEmLkJTnc9q6f37hMD1T3DBO+I1LfBvPjCgfc=";
|
||||
};
|
||||
"x86_64-darwin" = fetchFromGitHub
|
||||
{
|
||||
owner = "koekeishiya";
|
||||
repo = "yabai";
|
||||
rev = "v${finalAttrs.version}";
|
||||
hash = "sha256-oxQsCvTZqfKZoTuY1NC6h+Fzvyl0gJDhljFY2KrjRQ8=";
|
||||
};
|
||||
};
|
||||
|
||||
updateScript = writeShellScript "update-yabai" ''
|
||||
set -o errexit
|
||||
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)
|
||||
if [[ "${finalAttrs.version}" = "$NEW_VERSION" ]]; then
|
||||
echo "The new version same as the old version."
|
||||
exit 0
|
||||
fi
|
||||
for platform in ${lib.escapeShellArgs finalAttrs.meta.platforms}; do
|
||||
update-source-version "yabai" "0" "${lib.fakeHash}" --source-key="sources.$platform"
|
||||
update-source-version "yabai" "$NEW_VERSION" --source-key="sources.$platform"
|
||||
done
|
||||
'';
|
||||
};
|
||||
|
||||
meta = {
|
||||
|
@ -101,7 +122,7 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
homepage = "https://github.com/koekeishiya/yabai";
|
||||
changelog = "https://github.com/koekeishiya/yabai/blob/v${finalAttrs.version}/CHANGELOG.md";
|
||||
license = lib.licenses.mit;
|
||||
platforms = lib.platforms.darwin;
|
||||
platforms = builtins.attrNames finalAttrs.passthru.sources;
|
||||
mainProgram = "yabai";
|
||||
maintainers = with lib.maintainers; [
|
||||
cmacrae
|
||||
|
|
Loading…
Reference in New Issue