nixpkgs/pkgs/by-name/or/orchard/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

56 lines
1.6 KiB
Nix
Raw Normal View History

2023-09-15 04:40:27 +00:00
{ lib, fetchFromGitHub, buildGoModule, installShellFiles }:
buildGoModule rec {
pname = "orchard";
2023-11-03 02:51:44 +00:00
version = "0.14.3";
2023-09-15 04:40:27 +00:00
src = fetchFromGitHub {
owner = "cirruslabs";
repo = pname;
rev = version;
2023-11-03 02:51:44 +00:00
hash = "sha256-hQP48druIwkVVKeC1TKq+DEGOJOmkendc3Ij9ft+uDQ=";
2023-09-15 04:40:27 +00:00
# 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
'';
};
2023-11-03 02:51:44 +00:00
vendorHash = "sha256-opPxsCukXcLcrf/sD9AW1iIYOK5BmTLnc/QGUvzVLwg=";
2023-09-15 04:40:27 +00:00
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 ];
};
}