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.

77 lines
2.0 KiB
Nix
Raw Normal View History

2022-05-19 21:59:13 +00:00
{ lib
, buildGoModule
, fetchFromGitHub
, git
, stdenv
, testers
, crc
, runtimeShell
, coreutils
}:
let
openShiftVersion = "4.14.3";
okdVersion = "4.14.0-0.okd-2023-12-01-225814";
microshiftVersion = "4.14.3";
podmanVersion = "4.4.4";
writeKey = "$(MODULEPATH)/pkg/crc/segment.WriteKey=cvpHsNcmGCJqVzf6YxrSnVlwFSAZaYtp";
gitCommit = "b6532a3c38f2c81143153fed022bc4ebf3f2f508";
gitHash = "sha256-LH1vjWVzSeSswnMibn4YVjV2glauQGDXP+6i9kGzzU4=";
2022-05-19 21:59:13 +00:00
in
buildGoModule rec {
version = "2.30.0";
2022-05-19 21:59:13 +00:00
pname = "crc";
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/v2/pkg/crc/version.crcVersion=${version}"
"-X github.com/crc-org/crc/v2/pkg/crc/version.ocpVersion=${openShiftVersion}"
"-X github.com/crc-org/crc/v2/pkg/crc/version.okdVersion=${okdVersion}"
"-X github.com/crc-org/crc/v2/pkg/crc/version.podmanVersion=${podmanVersion}"
"-X github.com/crc-org/crc/v2/pkg/crc/version.microshiftVersion=${microshiftVersion}"
"-X github.com/crc-org/crc/v2/pkg/crc/version.commitSha=${builtins.substring 0 8 gitCommit}"
"-X github.com/crc-org/crc/v2/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
};
}