Skip to content

Commit

Permalink
Merge pull request NixOS#255223 from techknowlogick/orchard-init
Browse files Browse the repository at this point in the history
orchard: init at 0.12.0
  • Loading branch information
marsam committed Sep 22, 2023
2 parents a65921c + 31a534e commit 95d0033
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions pkgs/by-name/or/orchard/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{ lib, fetchFromGitHub, buildGoModule, installShellFiles }:

buildGoModule rec {
pname = "orchard";
version = "0.12.0";

src = fetchFromGitHub {
owner = "cirruslabs";
repo = pname;
rev = version;
hash = "sha256-+QNYlZ3/GiDtCySZPOlrDy03lkdGGvbFCWidQhbZJYQ=";
# populate values that require us to use git. By doing this in postFetch we
# can delete .git afterwards and maintain better reproducibility of the src.
leaveDotGit = true;
postFetch = ''
cd "$out"
git rev-parse HEAD > $out/COMMIT
find "$out" -name .git -print0 | xargs -0 rm -rf
'';
};

vendorHash = "sha256-BrzS+QtpGUHcYNNmSI6FlBtcYwNFri7R6nlVvFihdb4=";

nativeBuildInputs = [ installShellFiles ];

ldflags = [
"-w"
"-s"
"-X github.com/cirruslabs/orchard/internal/version.Version=${version}"
];

# ldflags based on metadata from git and source
preBuild = ''
ldflags+=" -X github.com/cirruslabs/orchard/internal/version.Commit=$(cat COMMIT)"
'';

subPackages = [ "cmd/orchard" ];

postInstall = ''
export HOME="$(mktemp -d)"
installShellCompletion --cmd orchard \
--bash <($out/bin/orchard completion bash) \
--zsh <($out/bin/orchard completion zsh) \
--fish <($out/bin/orchard completion fish)
'';

meta = with lib; {
mainProgram = "orchard";
description =
"Orchestrator for running Tart Virtual Machines on a cluster of Apple Silicon devices";
homepage = "https://github.com/cirruslabs/orchard";
license = licenses.fairsource09;
maintainers = with maintainers; [ techknowlogick ];
};
}

0 comments on commit 95d0033

Please sign in to comment.