nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchurl,
5 libgcc,
6 autoPatchelfHook,
7 testers,
8 oakctl,
9}:
10
11let
12 version = "0.13.2";
13
14 # Note: Extracted from install script
15 # https://oakctl-releases.luxonis.com/oakctl-installer.sh
16 sources = {
17 x86_64-linux = fetchurl {
18 url = "https://oakctl-releases.luxonis.com/data/${version}/linux_x86_64/oakctl";
19 hash = "sha256-uS7CUnj9+/kBwGaaZA9P6R2//vhZ1cJW+lhkQePZ0is=";
20 };
21 aarch64-linux = fetchurl {
22 url = "https://oakctl-releases.luxonis.com/data/${version}/linux_aarch64/oakctl";
23 hash = "sha256-+WFSV3TALeJtdcxkcduaN8tWGLCrOxvs3UV6cOr1xAI=";
24 };
25 aarch64-darwin = fetchurl {
26 url = "https://oakctl-releases.luxonis.com/data/${version}/darwin_arm64/oakctl";
27 hash = "sha256-OgVmfYcRNVcLGjEbxdVUtsV45vICj+jKPQJ578aRwZs=";
28 };
29 x86_64-darwin = fetchurl {
30 url = "https://oakctl-releases.luxonis.com/data/${version}/darwin_x86_64/oakctl";
31 hash = "sha256-KjJxwMRLs0XqiOTHjke+dSVKBftwBDYppjrqsbf0Qe8=";
32 };
33 };
34
35 src =
36 sources.${stdenv.hostPlatform.system}
37 or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
38in
39stdenv.mkDerivation (finalAttrs: {
40 pname = "oakctl";
41 inherit version src;
42
43 dontUnpack = true;
44 dontConfigure = true;
45 dontBuild = true;
46
47 passthru.tests.version = testers.testVersion {
48 command = "HOME=$TMPDIR oakctl version";
49 package = oakctl;
50 };
51
52 nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [ autoPatchelfHook ];
53
54 buildInputs = lib.optionals stdenv.hostPlatform.isLinux [
55 libgcc
56 stdenv.cc.cc.lib
57 ];
58
59 installPhase = ''
60 runHook preInstall
61
62 mkdir -p $out/bin
63 install -D -m 0755 $src $out/bin/oakctl
64
65 runHook postInstall
66 '';
67
68 # Note: The command 'oakctl self-update' won't work as the binary is located in the nix/store
69 meta = {
70 description = "Tool to interact with Luxonis OAK4 cameras";
71 homepage = "https://docs.luxonis.com/software-v3/oak-apps/oakctl/";
72 license = lib.licenses.unfree;
73 platforms = [
74 "x86_64-linux"
75 "aarch64-linux"
76 "x86_64-darwin"
77 "aarch64-darwin"
78 ];
79 mainProgram = "oakctl";
80 maintainers = with lib.maintainers; [ phodina ];
81 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
82 };
83})