2023-05-24 13:37:59 +00:00
|
|
|
{ lib, stdenv, buildGoModule, fetchFromGitHub, git, Cocoa, Virtualization, sigtool, testers, linuxkit }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-10-21 18:38:19 +00:00
|
|
|
buildGoModule rec {
|
|
|
|
pname = "linuxkit";
|
2022-11-21 17:40:18 +00:00
|
|
|
version = "1.0.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "linuxkit";
|
|
|
|
repo = "linuxkit";
|
|
|
|
rev = "v${version}";
|
2022-11-21 17:40:18 +00:00
|
|
|
sha256 = "sha256-8x9oJaYb/mN2TUaVrGOYi5/6TETD78jif0SwCSc0kyo=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-10-21 18:38:19 +00:00
|
|
|
vendorSha256 = null;
|
|
|
|
|
|
|
|
modRoot = "./src/cmd/linuxkit";
|
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
patches = [
|
|
|
|
./darwin-os-version.patch
|
|
|
|
./support-apple-11-sdk.patch
|
|
|
|
];
|
|
|
|
|
|
|
|
# - On macOS, an executable must be signed with the right entitlement(s) to be
|
|
|
|
# able to use the Virtualization framework at runtime.
|
|
|
|
# - sigtool is allows us to validly sign such executables with a dummy
|
|
|
|
# authority.
|
|
|
|
nativeBuildInputs = lib.optionals stdenv.isDarwin [ sigtool ];
|
|
|
|
buildInputs = lib.optionals stdenv.isDarwin [ Cocoa Virtualization ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-10-21 18:38:19 +00:00
|
|
|
ldflags = [
|
|
|
|
"-s"
|
|
|
|
"-w"
|
|
|
|
"-X github.com/linuxkit/linuxkit/src/cmd/linuxkit/version.Version=${version}"
|
|
|
|
];
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [ git ];
|
2022-10-21 18:38:19 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
# - Because this package definition doesn't build using the source's Makefile,
|
|
|
|
# we must manually call the sign target.
|
|
|
|
# - The binary stripping that nixpkgs does by default in the
|
|
|
|
# fixup phase removes such signing and entitlements, so we have to sign
|
|
|
|
# after stripping.
|
|
|
|
# - Finally, at the start of the fixup phase, the working directory is
|
|
|
|
# $sourceRoot/src/cmd/linuxkit, so it's simpler to use the sign target from
|
|
|
|
# the Makefile in that directory rather than $sourceRoot/Makefile.
|
|
|
|
postFixup = lib.optionalString stdenv.isDarwin ''
|
|
|
|
make sign LOCAL_TARGET=$out/bin/linuxkit
|
|
|
|
'';
|
2022-10-21 18:38:19 +00:00
|
|
|
passthru.tests.version = testers.testVersion {
|
|
|
|
package = linuxkit;
|
|
|
|
command = "linuxkit version";
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "A toolkit for building secure, portable and lean operating systems for containers";
|
|
|
|
license = licenses.asl20;
|
|
|
|
homepage = "https://github.com/linuxkit/linuxkit";
|
2022-10-21 18:38:19 +00:00
|
|
|
maintainers = with maintainers; [ nicknovitski ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|