tangled
alpha
login
or
join now
tjh.dev
/
nixpkgs
Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
0
fork
atom
overview
issues
pulls
pipelines
uhk-agent: use electron from nixpkgs
Nick Cao
2 years ago
ae1e3d46
5df4c757
+47
-13
2 changed files
expand all
collapse all
unified
split
pkgs
os-specific
linux
uhk-agent
default.nix
uhk-udev-rules
default.nix
+46
-12
pkgs/os-specific/linux/uhk-agent/default.nix
···
1
-
{ appimageTools, lib, fetchurl }:
0
0
0
0
0
0
0
0
0
0
2
let
3
pname = "uhk-agent";
4
version = "3.1.0";
0
5
src = fetchurl {
6
url = "https://github.com/UltimateHackingKeyboard/agent/releases/download/v${version}/UHK.Agent-${version}-linux-x86_64.AppImage";
7
name = "${pname}-${version}.AppImage";
···
12
name = "${pname}-${version}";
13
inherit src;
14
};
15
-
in appimageTools.wrapType2 {
0
16
inherit pname version src;
17
18
-
extraPkgs = pkgs: with pkgs; [ polkit udev ];
19
20
-
extraInstallCommands = ''
21
-
mv $out/bin/${pname}-${version} $out/bin/${pname}
0
0
0
22
23
-
install -m 444 -D ${appimageContents}/${pname}.desktop -t $out/share/applications
24
-
install -m 644 -D ${appimageContents}/resources/rules/50-uhk60.rules $out/rules/50-uhk60.rules
25
-
substituteInPlace $out/share/applications/${pname}.desktop \
26
-
--replace 'Exec=AppRun' 'Exec=${pname}'
27
-
cp -r ${appimageContents}/usr/share/icons $out/share
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
28
'';
29
-
# wrapType2 does not passthru pname+version
30
-
passthru.version = version;
31
32
meta = with lib; {
33
description = "Agent is the configuration application of the Ultimate Hacking Keyboard";
···
1
+
{ lib
2
+
, stdenvNoCC
3
+
, fetchurl
4
+
, appimageTools
5
+
, electron
6
+
, makeWrapper
7
+
, asar
8
+
, autoPatchelfHook
9
+
, libusb1
10
+
}:
11
+
12
let
13
pname = "uhk-agent";
14
version = "3.1.0";
15
+
16
src = fetchurl {
17
url = "https://github.com/UltimateHackingKeyboard/agent/releases/download/v${version}/UHK.Agent-${version}-linux-x86_64.AppImage";
18
name = "${pname}-${version}.AppImage";
···
23
name = "${pname}-${version}";
24
inherit src;
25
};
26
+
in
27
+
stdenvNoCC.mkDerivation {
28
inherit pname version src;
29
30
+
dontUnpack = true;
31
32
+
nativeBuildInputs = [
33
+
asar
34
+
makeWrapper
35
+
autoPatchelfHook
36
+
];
37
38
+
buildInputs = [
39
+
libusb1
40
+
];
41
+
42
+
installPhase = ''
43
+
runHook preInstall
44
+
45
+
mkdir -p "$out"/{opt,share/applications}
46
+
47
+
cp -r --no-preserve=mode "${appimageContents}/resources" "$out/opt/${pname}"
48
+
cp -r --no-preserve=mode "${appimageContents}/usr/share/icons" "$out/share/icons"
49
+
cp -r --no-preserve=mode "${appimageContents}/${pname}.desktop" "$out/share/applications/${pname}.desktop"
50
+
51
+
substituteInPlace "$out/share/applications/${pname}.desktop" \
52
+
--replace "Exec=AppRun" "Exec=${pname}"
53
+
54
+
asar extract "$out/opt/${pname}/app.asar" "$out/opt/${pname}/app.asar.unpacked"
55
+
rm "$out/opt/${pname}/app.asar"
56
+
57
+
makeWrapper "${electron}/bin/electron" "$out/bin/${pname}" \
58
+
--add-flags "$out/opt/${pname}/app.asar.unpacked" \
59
+
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \
60
+
--set-default ELECTRON_IS_DEV 0 \
61
+
--inherit-argv0
62
+
63
+
runHook postInstall
64
'';
0
0
65
66
meta = with lib; {
67
description = "Agent is the configuration application of the Ultimate Hacking Keyboard";
+1
-1
pkgs/os-specific/linux/uhk-udev-rules/default.nix
···
8
dontBuild = true;
9
installPhase = ''
10
runHook preInstall
11
-
install -D -m 644 ${uhk-agent.out}/rules/50-uhk60.rules $out/lib/udev/rules.d/50-uhk60.rules
12
runHook postInstall
13
'';
14
···
8
dontBuild = true;
9
installPhase = ''
10
runHook preInstall
11
+
install -D -m 644 ${uhk-agent.out}/opt/uhk-agent/rules/50-uhk60.rules $out/lib/udev/rules.d/50-uhk60.rules
12
runHook postInstall
13
'';
14