2023-11-16 04:20:00 +00:00
|
|
|
{ lib
|
|
|
|
, stdenvNoCC
|
|
|
|
, fetchurl
|
|
|
|
, appimageTools
|
|
|
|
, electron
|
|
|
|
, makeWrapper
|
|
|
|
, asar
|
|
|
|
, autoPatchelfHook
|
|
|
|
, libusb1
|
|
|
|
}:
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
let
|
|
|
|
pname = "uhk-agent";
|
2024-01-25 14:12:00 +00:00
|
|
|
version = "3.3.0";
|
2023-11-16 04:20:00 +00:00
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/UltimateHackingKeyboard/agent/releases/download/v${version}/UHK.Agent-${version}-linux-x86_64.AppImage";
|
|
|
|
name = "${pname}-${version}.AppImage";
|
2024-01-25 14:12:00 +00:00
|
|
|
sha256 = "sha256-jkIuXKTm8imq1U7kbQhK7LkEeI2qz0Gu7rWuDn6Ex+c=";
|
2022-05-18 14:49:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
appimageContents = appimageTools.extract {
|
|
|
|
name = "${pname}-${version}";
|
|
|
|
inherit src;
|
|
|
|
};
|
2023-11-16 04:20:00 +00:00
|
|
|
in
|
|
|
|
stdenvNoCC.mkDerivation {
|
2022-05-18 14:49:53 +00:00
|
|
|
inherit pname version src;
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
dontUnpack = true;
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
asar
|
|
|
|
makeWrapper
|
|
|
|
autoPatchelfHook
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
libusb1
|
|
|
|
];
|
|
|
|
|
2024-01-25 14:12:00 +00:00
|
|
|
autoPatchelfIgnoreMissingDeps = [
|
|
|
|
"libc.musl-x86_64.so.1"
|
|
|
|
];
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
mkdir -p "$out"/{opt,share/applications}
|
|
|
|
|
|
|
|
cp -r --no-preserve=mode "${appimageContents}/resources" "$out/opt/${pname}"
|
|
|
|
cp -r --no-preserve=mode "${appimageContents}/usr/share/icons" "$out/share/icons"
|
|
|
|
cp -r --no-preserve=mode "${appimageContents}/${pname}.desktop" "$out/share/applications/${pname}.desktop"
|
|
|
|
|
|
|
|
substituteInPlace "$out/share/applications/${pname}.desktop" \
|
|
|
|
--replace "Exec=AppRun" "Exec=${pname}"
|
|
|
|
|
|
|
|
asar extract "$out/opt/${pname}/app.asar" "$out/opt/${pname}/app.asar.unpacked"
|
|
|
|
rm "$out/opt/${pname}/app.asar"
|
2022-05-18 14:49:53 +00:00
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
makeWrapper "${electron}/bin/electron" "$out/bin/${pname}" \
|
|
|
|
--add-flags "$out/opt/${pname}/app.asar.unpacked" \
|
|
|
|
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \
|
|
|
|
--set-default ELECTRON_IS_DEV 0 \
|
|
|
|
--inherit-argv0
|
2022-05-18 14:49:53 +00:00
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
runHook postInstall
|
2022-05-18 14:49:53 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Agent is the configuration application of the Ultimate Hacking Keyboard";
|
|
|
|
homepage = "https://github.com/UltimateHackingKeyboard/agent";
|
|
|
|
license = licenses.unfreeRedistributable;
|
2023-10-19 13:55:26 +00:00
|
|
|
maintainers = with maintainers; [ ngiger nickcao ];
|
2022-05-18 14:49:53 +00:00
|
|
|
platforms = [ "x86_64-linux" ];
|
|
|
|
};
|
|
|
|
}
|