Nix packages for third-party projects that don't ship their own flakes
1{
2 lib,
3 stdenv,
4 fetchurl,
5 versionCheckHook,
6}:
7
8let
9 # Prebuilt static CLI from https://boxd.sh/downloads/cli (see quickstart).
10 # Platforms match the installer's PLATFORM matrix (no darwin-x86_64).
11 sources = {
12 x86_64-linux = {
13 url = "https://boxd.sh/downloads/cli/boxd-linux-amd64";
14 hash = "sha256-TlUeF41JcsMekeGx4y8dKyjTQ/oyHwJrSxRFLD2nYpc=";
15 };
16 aarch64-linux = {
17 url = "https://boxd.sh/downloads/cli/boxd-linux-arm64";
18 hash = "sha256-TVCIe9i6AdfltOBGiGWbpor0lPNX40sK3Xt35IJWOeE=";
19 };
20 aarch64-darwin = {
21 url = "https://boxd.sh/downloads/cli/boxd-darwin-arm64";
22 hash = "sha256-rSJjp67z+yES7DGDiUIKpi6jThGpN7nb8UwuOJ4zAT4=";
23 };
24 };
25
26 srcAttrs =
27 sources.${stdenv.hostPlatform.system} or (throw "boxd: unsupported system ${stdenv.hostPlatform.system}");
28in
29stdenv.mkDerivation (finalAttrs: {
30 pname = "boxd";
31 version = "0.1.23";
32
33 src = fetchurl {
34 inherit (srcAttrs) url hash;
35 };
36
37 dontUnpack = true;
38
39 installPhase = ''
40 runHook preInstall
41 install -Dm755 $src $out/bin/boxd
42 runHook postInstall
43 '';
44
45 nativeInstallCheckInputs = [ versionCheckHook ];
46 versionCheckProgram = "${placeholder "out"}/bin/boxd";
47 versionCheckProgramArg = "--version";
48 doInstallCheck = true;
49
50 meta = {
51 description = "CLI for boxd cloud VMs — create, fork, exec, and manage remote Linux machines";
52 homepage = "https://boxd.sh";
53 changelog = "https://docs.boxd.sh";
54 # Binary-only distribution; no open-source license published with the CLI.
55 license = lib.licenses.unfreeRedistributable;
56 mainProgram = "boxd";
57 platforms = builtins.attrNames sources;
58 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
59 };
60})