2022-09-09 14:08:57 +00:00
|
|
|
{ lib, stdenv, fetchurl, cpio, xar, undmg }:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "karabiner-elements";
|
2024-02-29 20:09:43 +00:00
|
|
|
version = "14.13.0";
|
2022-09-09 14:08:57 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/pqrs-org/Karabiner-Elements/releases/download/v${version}/Karabiner-Elements-${version}.dmg";
|
2024-02-29 20:09:43 +00:00
|
|
|
sha256 = "sha256-gmJwoht/Tfm5qMecmq1N6PSAIfWOqsvuHU8VDJY8bLw=";
|
2022-09-09 14:08:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
outputs = [ "out" "driver" ];
|
|
|
|
|
|
|
|
nativeBuildInputs = [ cpio xar undmg ];
|
|
|
|
|
|
|
|
unpackPhase = ''
|
|
|
|
undmg $src
|
|
|
|
xar -xf Karabiner-Elements.pkg
|
|
|
|
cd Installer.pkg
|
|
|
|
zcat Payload | cpio -i
|
|
|
|
cd ../Karabiner-DriverKit-VirtualHIDDevice.pkg
|
|
|
|
zcat Payload | cpio -i
|
|
|
|
cd ..
|
|
|
|
'';
|
|
|
|
|
|
|
|
sourceRoot = ".";
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
for f in *.pkg/Library/Launch{Agents,Daemons}/*.plist; do
|
|
|
|
substituteInPlace $f \
|
|
|
|
--replace "/Library/" "$out/Library/"
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out $driver
|
|
|
|
cp -R Installer.pkg/Applications Installer.pkg/Library $out
|
|
|
|
cp -R Karabiner-DriverKit-VirtualHIDDevice.pkg/Applications Karabiner-DriverKit-VirtualHIDDevice.pkg/Library $driver
|
|
|
|
|
|
|
|
cp "$out/Library/Application Support/org.pqrs/Karabiner-Elements/package-version" "$out/Library/Application Support/org.pqrs/Karabiner-Elements/version"
|
|
|
|
'';
|
|
|
|
|
2023-04-12 12:48:02 +00:00
|
|
|
passthru.updateScript = ./updater.sh;
|
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Karabiner-Elements is a powerful utility for keyboard customization on macOS Sierra (10.12) or later";
|
2022-09-09 14:08:57 +00:00
|
|
|
homepage = "https://karabiner-elements.pqrs.org/";
|
|
|
|
platforms = platforms.darwin;
|
|
|
|
maintainers = with maintainers; [ Enzime ];
|
|
|
|
license = licenses.unlicense;
|
|
|
|
};
|
|
|
|
}
|