about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/libkrunfw
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/libkrunfw')
-rw-r--r--nixpkgs/pkgs/development/libraries/libkrunfw/default.nix28
1 files changed, 18 insertions, 10 deletions
diff --git a/nixpkgs/pkgs/development/libraries/libkrunfw/default.nix b/nixpkgs/pkgs/development/libraries/libkrunfw/default.nix
index 10ff37460496..3b4bf0855d0f 100644
--- a/nixpkgs/pkgs/development/libraries/libkrunfw/default.nix
+++ b/nixpkgs/pkgs/development/libraries/libkrunfw/default.nix
@@ -13,29 +13,36 @@
 assert sevVariant -> stdenv.isx86_64;
 stdenv.mkDerivation rec {
   pname = "libkrunfw";
-  version = "3.3.0";
+  version = "3.11.0";
 
-  src = fetchFromGitHub {
+  src = if stdenv.isLinux then fetchFromGitHub {
     owner = "containers";
     repo = pname;
     rev = "v${version}";
-    hash = "sha256-ay+E5AgJeA0i3T4JDosDawwtezDGquzAvYEWHGbPidg=";
+    hash = "sha256-p5z3Dc7o/Ja3K0VlOWIPc0qOIU5p+JSxWe7QiVQNkjs=";
+  } else fetchurl {
+    url = "https://github.com/containers/libkrunfw/releases/download/v${version}/v${version}-with_macos_prebuilts.tar.gz";
+    hash = "sha256-XcdsK8L5NwMgelSMhE2YKYxaAin/3p/+GrljGGZpK5Y=";
   };
 
   kernelSrc = fetchurl {
-    url = "https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.15.59.tar.xz";
-    hash = "sha256-5t3GQgVzQNsGs7khwrMb/tLGETWejxRMPlz5w6wzvMs=";
+    url = "https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.2.9.tar.xz";
+    hash = "sha256-kDRJwWTAPw50KqzJIOGFY1heB6KMbLeeD9bDZpX9Q/U=";
   };
 
   preBuild = ''
-    substituteInPlace Makefile --replace 'curl $(KERNEL_REMOTE) -o $(KERNEL_TARBALL)' 'ln -s $(kernelSrc) $(KERNEL_TARBALL)'
+    substituteInPlace Makefile \
+      --replace 'curl $(KERNEL_REMOTE) -o $(KERNEL_TARBALL)' 'ln -s $(kernelSrc) $(KERNEL_TARBALL)' \
+      --replace 'gcc' '$(CC)'
   '';
 
   nativeBuildInputs = [ flex bison bc python3 python3.pkgs.pyelftools ];
-  buildInputs = [ elfutils ];
+  buildInputs = lib.optionals stdenv.isLinux [ elfutils ];
 
-  makeFlags = [ "PREFIX=${placeholder "out"}" ]
-    ++ lib.optional sevVariant "SEV=1";
+  makeFlags = [
+    "PREFIX=${placeholder "out"}"
+    "SONAME_Darwin=-Wl,-install_name,${placeholder "out"}/lib/libkrunfw.dylib"
+  ] ++ lib.optional sevVariant "SEV=1";
 
   enableParallelBuilding = true;
 
@@ -44,6 +51,7 @@ stdenv.mkDerivation rec {
     homepage = "https://github.com/containers/libkrunfw";
     license = with licenses; [ lgpl2Only lgpl21Only ];
     maintainers = with maintainers; [ nickcao ];
-    platforms = [ "x86_64-linux" "aarch64-linux" ];
+    platforms = [ "x86_64-linux" "aarch64-darwin" ];
+    sourceProvenance = with sourceTypes; lib.optionals stdenv.isDarwin [ binaryNativeCode ];
   };
 }