libkrun: add support for darwin
This commit is contained in:
parent
77525f0f95
commit
7642b5064e
@ -1,11 +1,15 @@
|
||||
{ lib
|
||||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, fetchurl
|
||||
, rustPlatform
|
||||
, pkg-config
|
||||
, dtc
|
||||
, glibc
|
||||
, openssl
|
||||
, libiconv
|
||||
, libkrunfw
|
||||
, Hypervisor
|
||||
, sevVariant ? false
|
||||
}:
|
||||
|
||||
@ -13,11 +17,14 @@ stdenv.mkDerivation rec {
|
||||
pname = "libkrun";
|
||||
version = "1.3.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
src = if stdenv.isLinux then fetchFromGitHub {
|
||||
owner = "containers";
|
||||
repo = pname;
|
||||
rev = "v${version}";
|
||||
hash = "sha256-qVyEqiqaQ8wfZhL5u+Bsaa1yXlgHUitSj5bo7FJ5Y8c=";
|
||||
} else fetchurl {
|
||||
url = "https://github.com/containers/libkrun/releases/download/v${version}/v${version}-with_macos_prebuilts.tar.gz";
|
||||
hash = "sha256-RBqeGUhB6Sdt+JujyQBW/76mZwnT0LNs9AMYr8+OCVU=";
|
||||
};
|
||||
|
||||
cargoDeps = rustPlatform.fetchCargoTarball {
|
||||
@ -25,21 +32,30 @@ stdenv.mkDerivation rec {
|
||||
hash = "sha256-jxSzhj1iU8qY+sZEVCYTaUqpaA4egjJi9qxrapASQF0=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = with rustPlatform;[
|
||||
nativeBuildInputs = with rustPlatform; [
|
||||
cargoSetupHook
|
||||
rust.cargo
|
||||
rust.rustc
|
||||
] ++ lib.optional sevVariant pkg-config;
|
||||
|
||||
buildInputs = [
|
||||
(libkrunfw.override { inherit sevVariant; })
|
||||
] ++ lib.optionals stdenv.isLinux [
|
||||
glibc
|
||||
glibc.static
|
||||
(libkrunfw.override { inherit sevVariant; })
|
||||
] ++ lib.optionals stdenv.isDarwin [
|
||||
libiconv
|
||||
Hypervisor
|
||||
dtc
|
||||
] ++ lib.optional sevVariant openssl;
|
||||
|
||||
makeFlags = [ "PREFIX=${placeholder "out"}" ]
|
||||
++ lib.optional sevVariant "SEV=1";
|
||||
|
||||
postFixup = lib.optionalString stdenv.isDarwin ''
|
||||
install_name_tool -id $out/lib/libkrun.dylib $out/lib/libkrun.${version}.dylib
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "A dynamic library providing Virtualization-based process isolation capabilities";
|
||||
homepage = "https://github.com/containers/libkrun";
|
||||
|
@ -23933,7 +23933,9 @@ with pkgs;
|
||||
|
||||
libcgroup = callPackage ../os-specific/linux/libcgroup { };
|
||||
|
||||
libkrun = callPackage ../development/libraries/libkrun { };
|
||||
libkrun = callPackage ../development/libraries/libkrun {
|
||||
inherit (darwin.apple_sdk.frameworks) Hypervisor;
|
||||
};
|
||||
|
||||
libkrun-sev = callPackage ../development/libraries/libkrun { sevVariant = true; };
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user