nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 83 lines 2.2 kB view raw
1{ 2 lib, 3 stdenv, 4 stdenvNoCC, 5 fetchurl, 6 appimageTools, 7 electron, 8 makeWrapper, 9 asar, 10 autoPatchelfHook, 11 libusb1, 12}: 13 14let 15 pname = "uhk-agent"; 16 version = "8.0.0"; 17 18 src = fetchurl { 19 url = "https://github.com/UltimateHackingKeyboard/agent/releases/download/v${version}/UHK.Agent-${version}-linux-x86_64.AppImage"; 20 name = "${pname}-${version}.AppImage"; 21 sha256 = "sha256-1XgmGAjLoxJ9ZyeaDSk8UC9fVVwkY83i+DRBRIQz7/M="; 22 }; 23 24 appimageContents = appimageTools.extract { 25 inherit pname version src; 26 }; 27in 28stdenvNoCC.mkDerivation { 29 inherit pname version src; 30 31 dontUnpack = true; 32 33 nativeBuildInputs = [ 34 asar 35 makeWrapper 36 autoPatchelfHook 37 ]; 38 39 buildInputs = [ 40 (lib.getLib stdenv.cc.cc) 41 libusb1 42 ]; 43 44 autoPatchelfIgnoreMissingDeps = [ 45 "libc.musl-x86_64.so.1" 46 ]; 47 48 installPhase = '' 49 runHook preInstall 50 51 mkdir -p "$out"/{opt,share/applications} 52 53 cp -r --no-preserve=mode "${appimageContents}/resources" "$out/opt/${pname}" 54 cp -r --no-preserve=mode "${appimageContents}/usr/share/icons" "$out/share/icons" 55 cp -r --no-preserve=mode "${appimageContents}/${pname}.desktop" "$out/share/applications/${pname}.desktop" 56 57 substituteInPlace "$out/share/applications/${pname}.desktop" \ 58 --replace "Exec=AppRun" "Exec=${pname}" 59 60 asar extract "$out/opt/${pname}/app.asar" "$out/opt/${pname}/app.asar.unpacked" 61 rm "$out/opt/${pname}/app.asar" 62 63 makeWrapper "${electron}/bin/electron" "$out/bin/${pname}" \ 64 --add-flags "$out/opt/${pname}/app.asar.unpacked" \ 65 --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}" \ 66 --set-default ELECTRON_IS_DEV 0 \ 67 --inherit-argv0 68 69 runHook postInstall 70 ''; 71 72 meta = with lib; { 73 description = "Agent is the configuration application of the Ultimate Hacking Keyboard"; 74 homepage = "https://github.com/UltimateHackingKeyboard/agent"; 75 license = licenses.unfreeRedistributable; 76 maintainers = with maintainers; [ 77 ngiger 78 nickcao 79 ]; 80 platforms = [ "x86_64-linux" ]; 81 sourceProvenance = [ lib.sourceTypes.binaryNativeCode ]; 82 }; 83}