Merge pull request #335700 from DontEatOreo/update-and-refactor-karabiner-elements

karabiner-elements: 14.13.0 -> 15.0.0, refactor and cleanup
This commit is contained in:
Atemu 2024-08-20 18:29:38 +02:00 committed by GitHub
commit 657b14eed0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 29 additions and 26 deletions

View File

@ -1,17 +1,32 @@
{ lib, stdenv, fetchurl, cpio, xar, undmg }:
{
lib,
stdenv,
fetchurl,
cpio,
xar,
undmg,
nix-update-script,
}:
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "karabiner-elements";
version = "14.13.0";
version = "15.0.0";
src = fetchurl {
url = "https://github.com/pqrs-org/Karabiner-Elements/releases/download/v${version}/Karabiner-Elements-${version}.dmg";
sha256 = "sha256-gmJwoht/Tfm5qMecmq1N6PSAIfWOqsvuHU8VDJY8bLw=";
url = "https://github.com/pqrs-org/Karabiner-Elements/releases/download/v${finalAttrs.version}/Karabiner-Elements-${finalAttrs.version}.dmg";
hash = "sha256-xWCsbkP9cVnDjWFTgWl5KrR7wEpcQYM4Md99pTI/l14=";
};
outputs = [ "out" "driver" ];
outputs = [
"out"
"driver"
];
nativeBuildInputs = [ cpio xar undmg ];
nativeBuildInputs = [
cpio
xar
undmg
];
unpackPhase = ''
undmg $src
@ -40,13 +55,14 @@ stdenv.mkDerivation rec {
cp "$out/Library/Application Support/org.pqrs/Karabiner-Elements/package-version" "$out/Library/Application Support/org.pqrs/Karabiner-Elements/version"
'';
passthru.updateScript = ./updater.sh;
passthru.updateScript = nix-update-script { };
meta = with lib; {
description = "Karabiner-Elements is a powerful utility for keyboard customization on macOS Sierra (10.12) or later";
meta = {
changelog = "https://github.com/pqrs-org/Karabiner-Elements/releases/tag/v${finalAttrs.version}";
description = "Karabiner-Elements is a powerful utility for keyboard customization on macOS Ventura (13) or later";
homepage = "https://karabiner-elements.pqrs.org/";
platforms = platforms.darwin;
license = lib.licenses.unlicense;
maintainers = [ ];
license = licenses.unlicense;
platforms = lib.platforms.darwin;
};
}
})

View File

@ -1,13 +0,0 @@
#!/usr/bin/env nix-shell
#!nix-shell -I nixpkgs=./. -i bash -p curl jq common-updater-scripts
set -eo pipefail
new_version="$(curl -s "https://api.github.com/repos/pqrs-org/Karabiner-Elements/releases/latest" | jq -r '.tag_name | ltrimstr("v")')"
old_version="$(sed -nE 's/\s*version = "(.*)".*/\1/p' ./default.nix)"
if [[ "$new_version" == "$old_version" ]]; then
echo "Already up to date!"
exit 0
fi
update-source-version karabiner-elements "${new_version}"