From f73bb818a15e176ff6352fd2db77a425b7d3533a Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Mon, 29 Aug 2022 04:59:16 +1000 Subject: [PATCH] karabiner-elements: init at 14.8.0 (#188129) Co-authored-by: Sandro --- .../darwin/karabiner-elements/default.nix | 50 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 52 insertions(+) create mode 100644 pkgs/os-specific/darwin/karabiner-elements/default.nix diff --git a/pkgs/os-specific/darwin/karabiner-elements/default.nix b/pkgs/os-specific/darwin/karabiner-elements/default.nix new file mode 100644 index 000000000000..6444c7f0e0ff --- /dev/null +++ b/pkgs/os-specific/darwin/karabiner-elements/default.nix @@ -0,0 +1,50 @@ +{ lib, stdenv, fetchurl, cpio, xar, undmg }: + +stdenv.mkDerivation rec { + pname = "karabiner-elements"; + version = "14.8.0"; + + src = fetchurl { + url = "https://github.com/pqrs-org/Karabiner-Elements/releases/download/v${version}/Karabiner-Elements-${version}.dmg"; + sha256 = "sha256-sQJgK3EoJf8wcr0iL9iZXl6NJArptUDTrDeNKwgEfuM="; + }; + + 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" + ''; + + meta = with lib; { + description = "Karabiner-Elements is a powerful utility for keyboard customization on macOS Sierra (10.12) or later."; + homepage = "https://karabiner-elements.pqrs.org/"; + platforms = platforms.darwin; + maintainers = with maintainers; [ Enzime ]; + license = licenses.unlicense; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 7cbf3ace0d0d..739d6ea6e424 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -24062,6 +24062,8 @@ with pkgs; jujuutils = callPackage ../os-specific/linux/jujuutils { }; + karabiner-elements = callPackage ../os-specific/darwin/karabiner-elements { }; + kbd = callPackage ../os-specific/linux/kbd { }; kbdlight = callPackage ../os-specific/linux/kbdlight { };