nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 fetchFromGitHub,
4 buildGoModule,
5 installShellFiles,
6}:
7
8buildGoModule rec {
9 pname = "orchard";
10 version = "0.37.0";
11
12 src = fetchFromGitHub {
13 owner = "cirruslabs";
14 repo = "orchard";
15 rev = version;
16 hash = "sha256-V5pBiF1IIfyyZIAoHnAccZ6YNddA4MosEJROJVEpwoo=";
17 # populate values that require us to use git. By doing this in postFetch we
18 # can delete .git afterwards and maintain better reproducibility of the src.
19 leaveDotGit = true;
20 postFetch = ''
21 cd "$out"
22 git rev-parse HEAD > $out/COMMIT
23 find "$out" -name .git -print0 | xargs -0 rm -rf
24 '';
25 };
26
27 vendorHash = "sha256-VHEj4y7XSfdbSeBo9+ZwBZXUj/ur0w6gPrxCt2xNQMM=";
28
29 nativeBuildInputs = [ installShellFiles ];
30
31 ldflags = [
32 "-w"
33 "-s"
34 "-X github.com/cirruslabs/orchard/internal/version.Version=${version}"
35 ];
36
37 # ldflags based on metadata from git and source
38 preBuild = ''
39 ldflags+=" -X github.com/cirruslabs/orchard/internal/version.Commit=$(cat COMMIT)"
40 '';
41
42 subPackages = [ "cmd/orchard" ];
43
44 postInstall = ''
45 export HOME="$(mktemp -d)"
46 installShellCompletion --cmd orchard \
47 --bash <($out/bin/orchard completion bash) \
48 --zsh <($out/bin/orchard completion zsh) \
49 --fish <($out/bin/orchard completion fish)
50 '';
51
52 meta = with lib; {
53 mainProgram = "orchard";
54 description = "Orchestrator for running Tart Virtual Machines on a cluster of Apple Silicon devices";
55 homepage = "https://github.com/cirruslabs/orchard";
56 license = licenses.fairsource09;
57 maintainers = with maintainers; [ techknowlogick ];
58 };
59}