nixpkgs/pkgs/applications/networking/cluster/crc/default.nix

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

75 lines
1.9 KiB
Nix
Raw Normal View History

2022-05-19 21:59:13 +00:00
{ lib
, buildGoModule
, fetchFromGitHub
, git
, stdenv
, testers
, crc
, runtimeShell
, coreutils
}:
let
2023-03-20 15:51:38 +00:00
openShiftVersion = "4.12.5";
okdVersion = "4.12.0-0.okd-2023-02-18-033438";
2023-02-02 19:36:16 +00:00
podmanVersion = "4.3.1";
2022-05-19 21:59:13 +00:00
writeKey = "cvpHsNcmGCJqVzf6YxrSnVlwFSAZaYtp";
2023-03-20 15:51:38 +00:00
gitHash = "sha256-zk/26cG2Rt3jpbhKgprtq2vx7pIQVi7cPUA90uoQa80=";
2022-05-19 21:59:13 +00:00
in
buildGoModule rec {
2023-03-20 15:51:38 +00:00
version = "2.15.0";
2022-05-19 21:59:13 +00:00
pname = "crc";
2023-03-20 15:51:38 +00:00
gitCommit = "72256c3cb00ac01519b26658dd5cfb0dd09b37a1";
modRoot = "cmd/crc";
2022-05-19 21:59:13 +00:00
src = fetchFromGitHub {
owner = "crc-org";
2022-05-19 21:59:13 +00:00
repo = "crc";
rev = "v${version}";
2023-03-20 15:51:38 +00:00
hash = gitHash;
2022-05-19 21:59:13 +00:00
};
2023-03-20 15:51:38 +00:00
vendorHash = null;
2022-05-19 21:59:13 +00:00
nativeBuildInputs = [ git ];
postPatch = ''
substituteInPlace pkg/crc/oc/oc_linux_test.go \
--replace "/bin/echo" "${coreutils}/bin/echo"
substituteInPlace Makefile \
--replace "/bin/bash" "${runtimeShell}"
'';
tags = [ "containers_image_openpgp" ];
ldflags = [
"-X github.com/crc-org/crc/pkg/crc/version.crcVersion=${version}"
"-X github.com/crc-org/crc/pkg/crc/version.ocpVersion=${openShiftVersion}"
"-X github.com/crc-org/crc/pkg/crc/version.okdVersion=${okdVersion}"
"-X github.com/crc-org/crc/pkg/crc/version.podmanVersion=${podmanVersion}"
"-X github.com/crc-org/crc/pkg/crc/version.commitSha=${builtins.substring 0 8 gitCommit}"
"-X github.com/crc-org/crc/pkg/crc/segment.WriteKey=${writeKey}"
2022-05-19 21:59:13 +00:00
];
preBuild = ''
export HOME=$(mktemp -d)
'';
passthru.tests.version = testers.testVersion {
package = crc;
command = ''
export HOME=$(mktemp -d)
crc version
'';
};
passthru.updateScript = ./update.sh;
2022-05-19 21:59:13 +00:00
meta = with lib; {
description = "Manages a local OpenShift 4.x cluster or a Podman VM optimized for testing and development purposes";
homepage = "https://crc.dev";
license = licenses.asl20;
2023-02-21 17:32:27 +00:00
maintainers = with maintainers; [ matthewpi shikanime tricktron ];
2022-05-19 21:59:13 +00:00
};
}