[Backport release-24.11] vfkit: build from source (#356866)

This commit is contained in:
Weijia Wang 2024-11-19 21:59:46 +01:00 committed by GitHub
commit 7ee36530ee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,31 +1,50 @@
{ {
lib, lib,
fetchurl, apple-sdk_14,
stdenvNoCC, buildGoModule,
darwin,
darwinMinVersionHook,
fetchFromGitHub,
testers, testers,
vfkit,
}: }:
stdenvNoCC.mkDerivation (finalAttrs: { buildGoModule rec {
pname = "vfkit"; pname = "vfkit";
version = "0.5.1"; version = "0.5.1";
src = fetchurl { src = fetchFromGitHub {
url = "https://github.com/crc-org/vfkit/releases/download/v${finalAttrs.version}/vfkit"; owner = "crc-org";
hash = "sha256-at+KsvsKO359d4VUvcSuio2ej5hM6//U4Mj/jqXwhEc="; repo = "vfkit";
rev = "v${version}";
hash = "sha256-9iPr9VhN60B6kBikdEIFAs5mMH+VcmnjGhLuIa3A2JU=";
}; };
dontUnpack = true; vendorHash = "sha256-6O1T9aOCymYXGAIR/DQBWfjc2sCyU/nZu9b1bIuXEps=";
installPhase = '' subPackages = [ "cmd/vfkit" ];
runHook preInstall
install -Dm755 $src $out/bin/vfkit ldflags = [
"-s"
"-w"
"-X github.com/crc-org/vfkit/pkg/cmdline.gitVersion=${src.rev}"
];
runHook postInstall nativeBuildInputs = [
darwin.sigtool
];
buildInputs = [
apple-sdk_14
(darwinMinVersionHook "11")
];
postFixup = ''
codesign --entitlements vf.entitlements -f -s - $out/bin/vfkit
''; '';
passthru.tests = { passthru.tests = {
version = testers.testVersion { package = finalAttrs.finalPackage; }; version = testers.testVersion { package = vfkit; };
}; };
meta = { meta = {
@ -34,9 +53,7 @@ stdenvNoCC.mkDerivation (finalAttrs: {
license = lib.licenses.asl20; license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ sarcasticadmin ]; maintainers = with lib.maintainers; [ sarcasticadmin ];
platforms = lib.platforms.darwin; platforms = lib.platforms.darwin;
# Source build will be possible after darwin SDK 12.0 bump sourceProvenance = [ lib.sourceTypes.fromSource ];
# https://github.com/NixOS/nixpkgs/pull/229210
sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
mainProgram = "vfkit"; mainProgram = "vfkit";
}; };
}) }