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 (Linux musl) / native (macOS) binaries from GitHub releases.
10 # Asset names: whetuu-v{version}-{target}.tar.gz — each archive is a single `whetuu`.
11 sources = {
12 x86_64-linux = {
13 url = "https://github.com/yamafaktory/whetuu/releases/download/v0.1.5/whetuu-v0.1.5-x86_64-linux-musl.tar.gz";
14 hash = "sha256-YJ8IdY7fe1e9/H1TLer/3Dj5pl4cZUdBwR+oPuHW/4Q=";
15 };
16 aarch64-linux = {
17 url = "https://github.com/yamafaktory/whetuu/releases/download/v0.1.5/whetuu-v0.1.5-aarch64-linux-musl.tar.gz";
18 hash = "sha256-H3EIRQH8GGuzELr5GAPt0tuvZVSaNn85fohu7Vkbq8o=";
19 };
20 x86_64-darwin = {
21 url = "https://github.com/yamafaktory/whetuu/releases/download/v0.1.5/whetuu-v0.1.5-x86_64-macos.tar.gz";
22 hash = "sha256-8mkq3G4s7HFA6gC2pDUZ1aZBA3uAyqoK6zBgZG5nVAk=";
23 };
24 aarch64-darwin = {
25 url = "https://github.com/yamafaktory/whetuu/releases/download/v0.1.5/whetuu-v0.1.5-aarch64-macos.tar.gz";
26 hash = "sha256-WTl+7W0zww7aMZTYfBxlSo/rofJy9EYrlhs9KrqlGyo=";
27 };
28 };
29
30 srcAttrs =
31 sources.${stdenv.hostPlatform.system}
32 or (throw "whetuu: unsupported system ${stdenv.hostPlatform.system}");
33in
34stdenv.mkDerivation (finalAttrs: {
35 pname = "whetuu";
36 version = "0.1.5";
37
38 src = fetchurl {
39 inherit (srcAttrs) url hash;
40 };
41
42 # Archive root is just the `whetuu` binary (no directory wrapper).
43 sourceRoot = ".";
44
45 installPhase = ''
46 runHook preInstall
47 install -Dm755 whetuu $out/bin/whetuu
48 runHook postInstall
49 '';
50
51 nativeInstallCheckInputs = [ versionCheckHook ];
52 versionCheckProgram = "${placeholder "out"}/bin/whetuu";
53 versionCheckProgramArg = "--version";
54 doInstallCheck = true;
55
56 meta = {
57 description = "Opinionated, zero-config cross-shell prompt written in Zig";
58 homepage = "https://github.com/yamafaktory/whetuu";
59 changelog = "https://github.com/yamafaktory/whetuu/releases/tag/v${finalAttrs.version}";
60 license = lib.licenses.mit;
61 mainProgram = "whetuu";
62 platforms = builtins.attrNames sources;
63 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
64 };
65})