Unverified Commit 657b14ee authored by Atemu's avatar Atemu Committed by GitHub
Browse files

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

karabiner-elements: 14.13.0 -> 15.0.0, refactor and cleanup
parents d52b09ef ea09687d
Loading
Loading
Loading
Loading
+29 −13
Original line number Diff line number Diff line
{ 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;
  };
}
})
+0 −13
Original line number Diff line number Diff line
#!/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}"