uhk-agent: use electron from nixpkgs
This commit is contained in:
parent
5df4c7570b
commit
ae1e3d4601
2 changed files with 47 additions and 13 deletions
|
@ -1,7 +1,18 @@
|
||||||
{ appimageTools, lib, fetchurl }:
|
{ lib
|
||||||
|
, stdenvNoCC
|
||||||
|
, fetchurl
|
||||||
|
, appimageTools
|
||||||
|
, electron
|
||||||
|
, makeWrapper
|
||||||
|
, asar
|
||||||
|
, autoPatchelfHook
|
||||||
|
, libusb1
|
||||||
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
pname = "uhk-agent";
|
pname = "uhk-agent";
|
||||||
version = "3.1.0";
|
version = "3.1.0";
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "https://github.com/UltimateHackingKeyboard/agent/releases/download/v${version}/UHK.Agent-${version}-linux-x86_64.AppImage";
|
url = "https://github.com/UltimateHackingKeyboard/agent/releases/download/v${version}/UHK.Agent-${version}-linux-x86_64.AppImage";
|
||||||
name = "${pname}-${version}.AppImage";
|
name = "${pname}-${version}.AppImage";
|
||||||
|
@ -12,22 +23,45 @@ let
|
||||||
name = "${pname}-${version}";
|
name = "${pname}-${version}";
|
||||||
inherit src;
|
inherit src;
|
||||||
};
|
};
|
||||||
in appimageTools.wrapType2 {
|
in
|
||||||
|
stdenvNoCC.mkDerivation {
|
||||||
inherit pname version src;
|
inherit pname version src;
|
||||||
|
|
||||||
extraPkgs = pkgs: with pkgs; [ polkit udev ];
|
dontUnpack = true;
|
||||||
|
|
||||||
extraInstallCommands = ''
|
nativeBuildInputs = [
|
||||||
mv $out/bin/${pname}-${version} $out/bin/${pname}
|
asar
|
||||||
|
makeWrapper
|
||||||
|
autoPatchelfHook
|
||||||
|
];
|
||||||
|
|
||||||
install -m 444 -D ${appimageContents}/${pname}.desktop -t $out/share/applications
|
buildInputs = [
|
||||||
install -m 644 -D ${appimageContents}/resources/rules/50-uhk60.rules $out/rules/50-uhk60.rules
|
libusb1
|
||||||
substituteInPlace $out/share/applications/${pname}.desktop \
|
];
|
||||||
--replace 'Exec=AppRun' 'Exec=${pname}'
|
|
||||||
cp -r ${appimageContents}/usr/share/icons $out/share
|
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"
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
# wrapType2 does not passthru pname+version
|
|
||||||
passthru.version = version;
|
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
description = "Agent is the configuration application of the Ultimate Hacking Keyboard";
|
description = "Agent is the configuration application of the Ultimate Hacking Keyboard";
|
||||||
|
|
|
@ -8,7 +8,7 @@ stdenv.mkDerivation {
|
||||||
dontBuild = true;
|
dontBuild = true;
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
runHook preInstall
|
runHook preInstall
|
||||||
install -D -m 644 ${uhk-agent.out}/rules/50-uhk60.rules $out/lib/udev/rules.d/50-uhk60.rules
|
install -D -m 644 ${uhk-agent.out}/opt/uhk-agent/rules/50-uhk60.rules $out/lib/udev/rules.d/50-uhk60.rules
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue