2021-12-11 17:24:32 +00:00
|
|
|
{ lib
|
2022-07-04 11:28:02 +00:00
|
|
|
, buildGoModule
|
2021-12-11 17:24:32 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, installShellFiles
|
|
|
|
, lima
|
|
|
|
, makeWrapper
|
2022-07-04 11:28:02 +00:00
|
|
|
, qemu
|
|
|
|
, testers
|
|
|
|
, colima
|
2021-12-11 17:24:32 +00:00
|
|
|
}:
|
|
|
|
|
2022-07-04 11:28:02 +00:00
|
|
|
buildGoModule rec {
|
2021-12-11 17:24:32 +00:00
|
|
|
pname = "colima";
|
2022-12-28 11:19:15 +00:00
|
|
|
version = "0.5.2";
|
2021-12-11 17:24:32 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "abiosoft";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2022-12-28 11:19:15 +00:00
|
|
|
sha256 = "sha256-xw+Yy9KejVkunOLJdmfXstP7aDrl3j0OZjCaf6pyL1U=";
|
2022-05-21 17:41:06 +00:00
|
|
|
# We need the git revision
|
|
|
|
leaveDotGit = true;
|
|
|
|
postFetch = ''
|
2022-07-04 11:28:02 +00:00
|
|
|
git -C $out rev-parse --short HEAD > $out/.git-revision
|
2022-05-21 17:41:06 +00:00
|
|
|
rm -rf $out/.git
|
|
|
|
'';
|
2021-12-11 17:24:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ installShellFiles makeWrapper ];
|
|
|
|
|
2022-12-28 11:19:15 +00:00
|
|
|
vendorSha256 = "sha256-Iz1LYL25NpkztTM86zrLwehub8FzO1IlwZqCPW7wDN4=";
|
2022-05-22 10:48:32 +00:00
|
|
|
|
2022-07-04 11:28:02 +00:00
|
|
|
CGO_ENABLED = 1;
|
2021-12-11 17:24:32 +00:00
|
|
|
|
2022-05-21 17:41:06 +00:00
|
|
|
preConfigure = ''
|
2022-07-04 11:28:02 +00:00
|
|
|
ldflags="-s -w -X github.com/abiosoft/colima/config.appVersion=${version} \
|
|
|
|
-X github.com/abiosoft/colima/config.revision=$(cat .git-revision)"
|
2022-05-21 17:41:06 +00:00
|
|
|
'';
|
|
|
|
|
2022-07-04 11:28:02 +00:00
|
|
|
subPackages = [ "cmd/colima" ];
|
|
|
|
|
2021-12-11 17:24:32 +00:00
|
|
|
postInstall = ''
|
|
|
|
wrapProgram $out/bin/colima \
|
2022-07-04 11:28:02 +00:00
|
|
|
--prefix PATH : ${lib.makeBinPath [ lima qemu ]}
|
2021-12-11 17:24:32 +00:00
|
|
|
|
|
|
|
installShellCompletion --cmd colima \
|
|
|
|
--bash <($out/bin/colima completion bash) \
|
|
|
|
--fish <($out/bin/colima completion fish) \
|
|
|
|
--zsh <($out/bin/colima completion zsh)
|
|
|
|
'';
|
|
|
|
|
2022-07-04 11:28:02 +00:00
|
|
|
passthru.tests.version = testers.testVersion {
|
|
|
|
package = colima;
|
|
|
|
command = "HOME=$(mktemp -d) colima version";
|
|
|
|
};
|
|
|
|
|
2021-12-11 17:24:32 +00:00
|
|
|
meta = with lib; {
|
2022-07-04 11:28:02 +00:00
|
|
|
description = "Container runtimes with minimal setup";
|
2021-12-11 17:24:32 +00:00
|
|
|
homepage = "https://github.com/abiosoft/colima";
|
|
|
|
license = licenses.mit;
|
2022-07-04 11:28:02 +00:00
|
|
|
maintainers = with maintainers; [ aaschmid tricktron ];
|
2021-12-11 17:24:32 +00:00
|
|
|
};
|
|
|
|
}
|