python3Packages.orjson: Disable failing tests on 32 bit
[NixPkgs.git] / pkgs / development / libraries / libkrun / default.nix
blob779f6790c5584d590b8cca4976f9b882dba5319c
1 { lib
2 , stdenv
3 , fetchFromGitHub
4 , fetchurl
5 , rustPlatform
6 , pkg-config
7 , dtc
8 , glibc
9 , openssl
10 , libiconv
11 , libkrunfw
12 , Hypervisor
13 , sevVariant ? false
16 stdenv.mkDerivation rec {
17   pname = "libkrun";
18   version = "1.3.0";
20   src = if stdenv.isLinux then fetchFromGitHub {
21     owner = "containers";
22     repo = pname;
23     rev = "v${version}";
24     hash = "sha256-qVyEqiqaQ8wfZhL5u+Bsaa1yXlgHUitSj5bo7FJ5Y8c=";
25   } else fetchurl {
26     url = "https://github.com/containers/libkrun/releases/download/v${version}/v${version}-with_macos_prebuilts.tar.gz";
27     hash = "sha256-RBqeGUhB6Sdt+JujyQBW/76mZwnT0LNs9AMYr8+OCVU=";
28   };
30   cargoDeps = rustPlatform.fetchCargoTarball {
31     inherit src;
32     hash = "sha256-jxSzhj1iU8qY+sZEVCYTaUqpaA4egjJi9qxrapASQF0=";
33   };
35   nativeBuildInputs = with rustPlatform; [
36     cargoSetupHook
37     rust.cargo
38     rust.rustc
39   ] ++ lib.optional sevVariant pkg-config;
41   buildInputs = [
42     (libkrunfw.override { inherit sevVariant; })
43   ] ++ lib.optionals stdenv.isLinux [
44     glibc
45     glibc.static
46   ] ++ lib.optionals stdenv.isDarwin [
47     libiconv
48     Hypervisor
49     dtc
50   ] ++ lib.optional sevVariant openssl;
52   makeFlags = [ "PREFIX=${placeholder "out"}" ]
53     ++ lib.optional sevVariant "SEV=1";
55   postFixup = lib.optionalString stdenv.isDarwin ''
56     install_name_tool -id $out/lib/libkrun.dylib $out/lib/libkrun.${version}.dylib
57   '';
59   meta = with lib; {
60     description = "A dynamic library providing Virtualization-based process isolation capabilities";
61     homepage = "https://github.com/containers/libkrun";
62     license = licenses.asl20;
63     maintainers = with maintainers; [ nickcao ];
64   };