Skip to content

Commit

Permalink
yabai: modernize
Browse files Browse the repository at this point in the history
  • Loading branch information
khaneliman committed Oct 31, 2024
1 parent 68f965c commit 1f42981
Showing 1 changed file with 3 additions and 23 deletions.
26 changes: 3 additions & 23 deletions pkgs/by-name/ya/yabai/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,13 @@
fetchFromGitHub,
installShellFiles,
testers,
writeShellScript,
common-updater-scripts,
curl,
jq,
xcodebuild,
xxd,
yabai,
apple-sdk_15,
darwinMinVersionHook,
llvmPackages_19,
nix-update-script,
}:
let
stdenv = llvmPackages_19.stdenv;
Expand All @@ -24,7 +21,7 @@ stdenv.mkDerivation (finalAttrs: {
src = fetchFromGitHub {
owner = "koekeishiya";
repo = "yabai";
rev = "v${finalAttrs.version}";
rev = "refs/tags/v${finalAttrs.version}";
hash = "sha256-i/UqmBNTLBYY4ORI1Y7FWr+LZK0f/qMdWLPPuTb9+2w=";
};

Expand Down Expand Up @@ -69,24 +66,7 @@ stdenv.mkDerivation (finalAttrs: {
version = "yabai-v${finalAttrs.version}";
};

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" "$NEW_VERSION" --ignore-same-version --source-key="sources.$platform"
done
'';
updateScript = nix-update-script { };
};

meta = {
Expand Down

0 comments on commit 1f42981

Please sign in to comment.