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 release tarballs from https://github.com/pullrun/pullrun/releases.
10 # Each archive has pullrun-{os}-{arch} + pullrun-runtime-{os}-{arch} (static).
11 sources = {
12 x86_64-linux = {
13 url = "https://github.com/pullrun/pullrun/releases/download/v0.6.7/pullrun-0.6.7-linux-amd64.tar.gz";
14 hash = "sha256-aFIa59shNN+Ptt8vd39fRvY1Gjh5WghZLrAc7lmRtkw=";
15 };
16 aarch64-linux = {
17 url = "https://github.com/pullrun/pullrun/releases/download/v0.6.7/pullrun-0.6.7-linux-arm64.tar.gz";
18 hash = "sha256-Ct0fm26gMwqx9tw96X8TW5xnUZpwC9HXgzn5tDr7cy4=";
19 };
20 x86_64-darwin = {
21 url = "https://github.com/pullrun/pullrun/releases/download/v0.6.7/pullrun-0.6.7-darwin-amd64.tar.gz";
22 hash = "sha256-f9xQJcH5CpcwbHSOZg7K7fWdRjipUkiYMCywbGQ025c=";
23 };
24 aarch64-darwin = {
25 url = "https://github.com/pullrun/pullrun/releases/download/v0.6.7/pullrun-0.6.7-darwin-arm64.tar.gz";
26 hash = "sha256-tj1K0VKI2UnWUT8lqTiXC9MD4qM8R4iYy/AoNBLTr/8=";
27 };
28 };
29
30 srcAttrs =
31 sources.${stdenv.hostPlatform.system}
32 or (throw "pullrun: unsupported system ${stdenv.hostPlatform.system}");
33in
34stdenv.mkDerivation (finalAttrs: {
35 pname = "pullrun";
36 version = "0.6.7";
37
38 src = fetchurl {
39 inherit (srcAttrs) url hash;
40 };
41
42 # Archive root is the two platform-suffixed binaries (no directory wrapper).
43 sourceRoot = ".";
44
45 installPhase = ''
46 runHook preInstall
47 mkdir -p $out/bin
48 for f in pullrun-*; do
49 case "$f" in
50 pullrun-runtime-*)
51 install -Dm755 "$f" $out/bin/pullrun-runtime
52 ;;
53 pullrun-*)
54 install -Dm755 "$f" $out/bin/pullrun
55 ;;
56 esac
57 done
58 test -x $out/bin/pullrun
59 test -x $out/bin/pullrun-runtime
60 runHook postInstall
61 '';
62
63 nativeInstallCheckInputs = [ versionCheckHook ];
64 versionCheckProgram = "${placeholder "out"}/bin/pullrun";
65 versionCheckProgramArg = "--version";
66 doInstallCheck = true;
67
68 meta = {
69 description = "Container runtime with zero-copy DAG storage — run OCI images as containers, Firecracker microVMs, or Apple Silicon VMs";
70 homepage = "https://github.com/pullrun/pullrun";
71 changelog = "https://github.com/pullrun/pullrun/releases/tag/v${finalAttrs.version}";
72 license = lib.licenses.asl20;
73 mainProgram = "pullrun";
74 platforms = builtins.attrNames sources;
75 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
76 };
77})