1{ stdenv, fetchgit, lib, dtc }:
2
3stdenv.mkDerivation {
4 pname = "kvmtool";
5 version = "unstable-2023-07-12";
6
7 src = fetchgit {
8 url = "https://git.kernel.org/pub/scm/linux/kernel/git/will/kvmtool.git";
9 rev = "106e2ea7756d980454d68631b87d5e25ba4e4881";
10 sha256 = "sha256-wpc5DfHnui0lBVH4uOq6a7pXVUZStjNLRvauu6QpRvE=";
11 };
12
13 patches = [ ./strlcpy-glibc-2.38-fix.patch ];
14
15 buildInputs = lib.optionals stdenv.hostPlatform.isAarch64 [ dtc ];
16
17 enableParallelBuilding = true;
18
19 makeFlags = [
20 "prefix=${placeholder "out"}"
21 ] ++ lib.optionals stdenv.hostPlatform.isAarch64 ([
22 "LIBFDT_DIR=${dtc}/lib"
23 ] ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
24 "CROSS_COMPILE=aarch64-unknown-linux-gnu-"
25 "ARCH=arm64"
26 ]);
27
28 meta = with lib; {
29 description = "A lightweight tool for hosting KVM guests";
30 homepage = "https://git.kernel.org/pub/scm/linux/kernel/git/will/kvmtool.git/tree/README";
31 license = licenses.gpl2Only;
32 maintainers = with maintainers; [ astro mfrw ];
33 platforms = [ "x86_64-linux" "aarch64-linux" ];
34 mainProgram = "lkvm";
35 };
36}