nixpkgs/pkgs/development/libraries/libkrun/default.nix

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

70 lines
1.7 KiB
Nix
Raw Normal View History

2022-08-13 09:43:05 +00:00
{ lib
, stdenv
, fetchFromGitHub
2022-08-16 16:46:05 +00:00
, fetchurl
2022-08-13 09:43:05 +00:00
, rustPlatform
, cargo
2022-08-13 09:43:05 +00:00
, pkg-config
2022-08-16 16:46:05 +00:00
, dtc
2022-08-13 09:43:05 +00:00
, glibc
, openssl
2022-08-16 16:46:05 +00:00
, libiconv
2022-08-13 09:43:05 +00:00
, libkrunfw
, rustc
2022-08-16 16:46:05 +00:00
, Hypervisor
2022-08-13 09:43:05 +00:00
, sevVariant ? false
}:
stdenv.mkDerivation rec {
pname = "libkrun";
version = "1.5.1";
2022-08-13 09:43:05 +00:00
2022-08-16 16:46:05 +00:00
src = if stdenv.isLinux then fetchFromGitHub {
2022-08-13 09:43:05 +00:00
owner = "containers";
repo = pname;
rev = "v${version}";
hash = "sha256-N9AkG+zkjQHNaaCVrEpMfWUN9bQNHjMA2xi5NUulF5A=";
2022-08-16 16:46:05 +00:00
} else fetchurl {
url = "https://github.com/containers/libkrun/releases/download/v${version}/v${version}-with_macos_prebuilts.tar.gz";
hash = "sha256-8hPbnZtDbiVdwBrtxt4nZ/QA2OFtui2VsQlaoOmWybo=";
2022-08-13 09:43:05 +00:00
};
cargoDeps = rustPlatform.fetchCargoTarball {
inherit src;
hash = "sha256-nbtp7FP+ObVGfDOEzTt4Z7TZwcNlREczTKIAXGSflZU=";
2022-08-13 09:43:05 +00:00
};
nativeBuildInputs = [
rustPlatform.cargoSetupHook
cargo
rustc
2022-08-13 09:43:05 +00:00
] ++ lib.optional sevVariant pkg-config;
buildInputs = [
2022-08-16 16:46:05 +00:00
(libkrunfw.override { inherit sevVariant; })
] ++ lib.optionals stdenv.isLinux [
2022-08-13 09:43:05 +00:00
glibc
glibc.static
2022-08-16 16:46:05 +00:00
] ++ lib.optionals stdenv.isDarwin [
libiconv
Hypervisor
dtc
2022-08-13 09:43:05 +00:00
] ++ lib.optional sevVariant openssl;
makeFlags = [ "PREFIX=${placeholder "out"}" ]
++ lib.optional sevVariant "SEV=1";
2022-08-16 16:46:05 +00:00
postFixup = lib.optionalString stdenv.isDarwin ''
install_name_tool -id $out/lib/libkrun.dylib $out/lib/libkrun.${version}.dylib
'';
2022-08-13 09:43:05 +00:00
meta = with lib; {
description = "A dynamic library providing Virtualization-based process isolation capabilities";
homepage = "https://github.com/containers/libkrun";
license = licenses.asl20;
maintainers = with maintainers; [ nickcao ];
platforms = libkrunfw.meta.platforms;
sourceProvenance = with sourceTypes; lib.optionals stdenv.isDarwin [ binaryNativeCode ];
2022-08-13 09:43:05 +00:00
};
}