2021-12-11 17:24:32 +00:00
|
|
|
{ lib
|
2023-01-27 16:15:00 +00:00
|
|
|
, stdenv
|
2023-03-06 08:13:58 +00:00
|
|
|
, darwin
|
2022-07-04 11:28:02 +00:00
|
|
|
, buildGoModule
|
2021-12-11 17:24:32 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, installShellFiles
|
|
|
|
, lima
|
2023-01-27 16:15:00 +00:00
|
|
|
, lima-bin
|
2021-12-11 17:24:32 +00:00
|
|
|
, makeWrapper
|
2022-07-04 11:28:02 +00:00
|
|
|
, qemu
|
|
|
|
, testers
|
|
|
|
, colima
|
2023-02-05 12:56:26 +00:00
|
|
|
# use lima-bin on darwin to support native macOS virtualization
|
|
|
|
# https://github.com/NixOS/nixpkgs/pull/209171
|
|
|
|
, lima-drv ? if stdenv.isDarwin then lima-bin else lima
|
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";
|
2023-03-11 10:32:13 +00:00
|
|
|
version = "0.5.4";
|
2021-12-11 17:24:32 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "abiosoft";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2023-03-11 10:32:13 +00:00
|
|
|
sha256 = "sha256-oCYHQFajtZXVAVeJ8zvJABlmwmOUgisvVg9eLT7wd0M=";
|
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
|
|
|
};
|
|
|
|
|
2023-03-06 08:54:01 +00:00
|
|
|
nativeBuildInputs = [ installShellFiles makeWrapper ]
|
|
|
|
++ lib.optionals stdenv.isDarwin [ darwin.DarwinTools ];
|
2021-12-11 17:24:32 +00:00
|
|
|
|
2023-03-07 09:06:11 +00:00
|
|
|
vendorHash = "sha256-bEgC7j8WvCgrJ2Ahye4mfWVEmo6Y/OO64mDIJXvtaiE=";
|
2022-05-22 10:48:32 +00:00
|
|
|
|
2023-03-16 07:25:52 +00:00
|
|
|
# disable flaky Test_extractZones
|
|
|
|
# https://hydra.nixos.org/build/212378003/log
|
|
|
|
excludedPackages = "gvproxy";
|
|
|
|
|
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
|
|
|
'';
|
|
|
|
|
2021-12-11 17:24:32 +00:00
|
|
|
postInstall = ''
|
|
|
|
wrapProgram $out/bin/colima \
|
2023-01-27 16:15:00 +00:00
|
|
|
--prefix PATH : ${lib.makeBinPath [ lima-drv 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
|
|
|
};
|
|
|
|
}
|