2021-09-18 10:52:07 +00:00
|
|
|
|
{ lib
|
2022-09-22 12:36:57 +00:00
|
|
|
|
, bash
|
2022-03-30 09:31:56 +00:00
|
|
|
|
, bash-completion
|
|
|
|
|
, bridge-utils
|
2021-09-18 10:52:07 +00:00
|
|
|
|
, coreutils
|
2022-03-30 09:31:56 +00:00
|
|
|
|
, curl
|
|
|
|
|
, darwin
|
|
|
|
|
, dbus
|
|
|
|
|
, dnsmasq
|
2021-09-18 10:52:07 +00:00
|
|
|
|
, docutils
|
2022-03-30 09:31:56 +00:00
|
|
|
|
, fetchFromGitLab
|
2024-05-15 15:35:15 +00:00
|
|
|
|
, fetchpatch
|
2021-09-18 10:52:07 +00:00
|
|
|
|
, gettext
|
2022-03-30 09:31:56 +00:00
|
|
|
|
, glib
|
|
|
|
|
, gnutls
|
|
|
|
|
, iproute2
|
2021-09-18 10:52:07 +00:00
|
|
|
|
, iptables
|
|
|
|
|
, libgcrypt
|
|
|
|
|
, libpcap
|
2022-03-30 09:31:56 +00:00
|
|
|
|
, libtasn1
|
|
|
|
|
, libxml2
|
2021-09-18 10:52:07 +00:00
|
|
|
|
, libxslt
|
2022-03-30 09:31:56 +00:00
|
|
|
|
, makeWrapper
|
2021-09-18 10:52:07 +00:00
|
|
|
|
, meson
|
|
|
|
|
, ninja
|
2023-03-24 00:07:29 +00:00
|
|
|
|
, openssh
|
2022-03-30 09:31:56 +00:00
|
|
|
|
, perl
|
|
|
|
|
, perlPackages
|
2022-04-27 09:35:20 +00:00
|
|
|
|
, polkit
|
2021-09-18 10:52:07 +00:00
|
|
|
|
, pkg-config
|
2022-03-30 09:31:56 +00:00
|
|
|
|
, pmutils
|
|
|
|
|
, python3
|
|
|
|
|
, readline
|
|
|
|
|
, rpcsvc-proto
|
|
|
|
|
, stdenv
|
2022-09-22 12:36:57 +00:00
|
|
|
|
, substituteAll
|
2022-03-30 09:31:56 +00:00
|
|
|
|
, xhtml1
|
|
|
|
|
, yajl
|
2022-06-16 17:23:12 +00:00
|
|
|
|
, writeScript
|
2022-09-09 14:08:57 +00:00
|
|
|
|
, nixosTests
|
2022-03-30 09:31:56 +00:00
|
|
|
|
|
|
|
|
|
# Linux
|
|
|
|
|
, acl ? null
|
|
|
|
|
, attr ? null
|
|
|
|
|
, audit ? null
|
|
|
|
|
, dmidecode ? null
|
2023-02-02 18:25:31 +00:00
|
|
|
|
, fuse3 ? null
|
2022-03-30 09:31:56 +00:00
|
|
|
|
, kmod ? null
|
|
|
|
|
, libapparmor ? null
|
|
|
|
|
, libcap_ng ? null
|
|
|
|
|
, libnl ? null
|
|
|
|
|
, libpciaccess ? null
|
|
|
|
|
, libtirpc ? null
|
|
|
|
|
, lvm2 ? null
|
|
|
|
|
, numactl ? null
|
|
|
|
|
, numad ? null
|
|
|
|
|
, parted ? null
|
|
|
|
|
, systemd ? null
|
|
|
|
|
, util-linux ? null
|
|
|
|
|
|
|
|
|
|
# Darwin
|
2022-09-09 14:08:57 +00:00
|
|
|
|
, gmp
|
|
|
|
|
, libiconv
|
2022-11-21 17:40:18 +00:00
|
|
|
|
, qemu
|
2022-09-09 14:08:57 +00:00
|
|
|
|
, Carbon
|
|
|
|
|
, AppKit
|
2022-03-30 09:31:56 +00:00
|
|
|
|
|
|
|
|
|
# Options
|
2021-09-18 10:52:07 +00:00
|
|
|
|
, enableCeph ? false
|
2022-09-09 14:08:57 +00:00
|
|
|
|
, ceph
|
2021-09-18 10:52:07 +00:00
|
|
|
|
, enableGlusterfs ? false
|
2022-09-09 14:08:57 +00:00
|
|
|
|
, glusterfs
|
2022-03-30 09:31:56 +00:00
|
|
|
|
, enableIscsi ? false
|
2022-09-09 14:08:57 +00:00
|
|
|
|
, openiscsi
|
|
|
|
|
, libiscsi
|
2022-03-30 09:31:56 +00:00
|
|
|
|
, enableXen ? false
|
2022-09-09 14:08:57 +00:00
|
|
|
|
, xen
|
2022-03-30 09:31:56 +00:00
|
|
|
|
, enableZfs ? stdenv.isLinux
|
2022-09-09 14:08:57 +00:00
|
|
|
|
, zfs
|
2020-04-24 23:36:52 +00:00
|
|
|
|
}:
|
|
|
|
|
|
|
|
|
|
let
|
2022-03-30 09:31:56 +00:00
|
|
|
|
inherit (stdenv) isDarwin isLinux isx86_64;
|
2023-02-02 18:25:31 +00:00
|
|
|
|
binPath = lib.makeBinPath ([
|
2022-03-30 09:31:56 +00:00
|
|
|
|
dnsmasq
|
2023-02-02 18:25:31 +00:00
|
|
|
|
] ++ lib.optionals isLinux [
|
2022-03-30 09:31:56 +00:00
|
|
|
|
bridge-utils
|
|
|
|
|
dmidecode
|
|
|
|
|
dnsmasq
|
|
|
|
|
iproute2
|
|
|
|
|
iptables
|
|
|
|
|
kmod
|
|
|
|
|
lvm2
|
|
|
|
|
numactl
|
|
|
|
|
numad
|
2023-03-24 00:07:29 +00:00
|
|
|
|
openssh
|
2022-03-30 09:31:56 +00:00
|
|
|
|
pmutils
|
|
|
|
|
systemd
|
2023-02-02 18:25:31 +00:00
|
|
|
|
] ++ lib.optionals enableIscsi [
|
2022-03-30 09:31:56 +00:00
|
|
|
|
libiscsi
|
|
|
|
|
openiscsi
|
2023-02-02 18:25:31 +00:00
|
|
|
|
] ++ lib.optionals enableZfs [
|
2022-07-14 12:49:19 +00:00
|
|
|
|
zfs
|
2022-03-30 09:31:56 +00:00
|
|
|
|
]);
|
2021-09-18 10:52:07 +00:00
|
|
|
|
in
|
2022-03-30 09:31:56 +00:00
|
|
|
|
|
|
|
|
|
assert enableXen -> isLinux && isx86_64;
|
|
|
|
|
assert enableCeph -> isLinux;
|
|
|
|
|
assert enableGlusterfs -> isLinux;
|
|
|
|
|
assert enableZfs -> isLinux;
|
|
|
|
|
|
|
|
|
|
# if you update, also bump <nixpkgs/pkgs/development/python-modules/libvirt/default.nix> and SysVirt in <nixpkgs/pkgs/top-level/perl-packages.nix>
|
2021-09-18 10:52:07 +00:00
|
|
|
|
stdenv.mkDerivation rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
|
pname = "libvirt";
|
2022-03-30 09:31:56 +00:00
|
|
|
|
# NOTE: You must also bump:
|
|
|
|
|
# <nixpkgs/pkgs/development/python-modules/libvirt/default.nix>
|
|
|
|
|
# SysVirt in <nixpkgs/pkgs/top-level/perl-packages.nix>
|
2024-02-07 01:22:34 +00:00
|
|
|
|
version = "10.0.0";
|
2022-06-16 17:23:12 +00:00
|
|
|
|
|
|
|
|
|
src = fetchFromGitLab {
|
|
|
|
|
owner = pname;
|
|
|
|
|
repo = pname;
|
|
|
|
|
rev = "v${version}";
|
2024-02-07 01:22:34 +00:00
|
|
|
|
hash = "sha256-xFl8AHcbeuydWzhJNnwZ3Bd7TQiTU8hjBxaALXvcLgE=";
|
2022-06-16 17:23:12 +00:00
|
|
|
|
fetchSubmodules = true;
|
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
|
patches = [
|
|
|
|
|
./0001-meson-patch-in-an-install-prefix-for-building-on-nix.patch
|
2024-05-15 15:35:15 +00:00
|
|
|
|
(fetchpatch {
|
|
|
|
|
name = "CVE-2024-2494.patch";
|
|
|
|
|
url = "https://gitlab.com/libvirt/libvirt/-/commit/8a3f8d957507c1f8223fdcf25a3ff885b15557f2.patch";
|
|
|
|
|
hash = "sha256-kxSIZ4bPOhN6PpJepoSF+EDTgdmazRWh3a3KSVfm1GU=";
|
|
|
|
|
})
|
|
|
|
|
(fetchpatch {
|
|
|
|
|
name = "CVE-2024-1441.patch";
|
|
|
|
|
url = "https://gitlab.com/libvirt/libvirt/-/commit/c664015fe3a7bf59db26686e9ed69af011c6ebb8.patch";
|
|
|
|
|
hash = "sha256-Qi/gk7+NPz9s9OpWOnF8XW6A75C9BbVxBTE4KVwalo4=";
|
|
|
|
|
})
|
2022-10-06 18:32:54 +00:00
|
|
|
|
] ++ lib.optionals enableZfs [
|
2022-09-22 12:36:57 +00:00
|
|
|
|
(substituteAll {
|
|
|
|
|
src = ./0002-substitute-zfs-and-zpool-commands.patch;
|
|
|
|
|
zfs = "${zfs}/bin/zfs";
|
|
|
|
|
zpool = "${zfs}/bin/zpool";
|
|
|
|
|
})
|
2021-01-15 22:18:51 +00:00
|
|
|
|
];
|
|
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
|
# remove some broken tests
|
|
|
|
|
postPatch = ''
|
|
|
|
|
sed -i '/commandtest/d' tests/meson.build
|
|
|
|
|
sed -i '/virnetsockettest/d' tests/meson.build
|
|
|
|
|
# delete only the first occurrence of this
|
|
|
|
|
sed -i '0,/qemuxml2argvtest/{/qemuxml2argvtest/d;}' tests/meson.build
|
2022-09-22 12:36:57 +00:00
|
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
|
'' + lib.optionalString isLinux ''
|
2022-09-22 12:36:57 +00:00
|
|
|
|
for binary in mount umount mkfs; do
|
|
|
|
|
substituteInPlace meson.build \
|
|
|
|
|
--replace "find_program('$binary'" "find_program('${lib.getBin util-linux}/bin/$binary'"
|
|
|
|
|
done
|
|
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
|
'' + ''
|
2022-09-22 12:36:57 +00:00
|
|
|
|
substituteInPlace meson.build \
|
|
|
|
|
--replace "'dbus-daemon'," "'${lib.getBin dbus}/bin/dbus-daemon',"
|
2023-02-02 18:25:31 +00:00
|
|
|
|
'' + lib.optionalString isLinux ''
|
2022-09-09 14:08:57 +00:00
|
|
|
|
sed -i 's,define PARTED "parted",define PARTED "${parted}/bin/parted",' \
|
|
|
|
|
src/storage/storage_backend_disk.c \
|
|
|
|
|
src/storage/storage_util.c
|
2023-02-02 18:25:31 +00:00
|
|
|
|
'' + lib.optionalString isDarwin ''
|
2023-11-16 04:20:00 +00:00
|
|
|
|
# Darwin doesn’t support -fsemantic-interposition, but the problem doesn’t seem to affect Mach-O.
|
|
|
|
|
# See https://gitlab.com/libvirt/libvirt/-/merge_requests/235
|
|
|
|
|
sed -i "s/not supported_cc_flags.contains('-fsemantic-interposition')/false/" meson.build
|
2022-11-21 17:40:18 +00:00
|
|
|
|
sed -i '/qemufirmwaretest/d' tests/meson.build
|
2024-02-29 20:09:43 +00:00
|
|
|
|
sed -i '/qemuhotplugtest/d' tests/meson.build
|
2022-11-21 17:40:18 +00:00
|
|
|
|
sed -i '/qemuvhostusertest/d' tests/meson.build
|
2023-04-12 12:48:02 +00:00
|
|
|
|
sed -i '/qemuxml2xmltest/d' tests/meson.build
|
2022-03-30 09:31:56 +00:00
|
|
|
|
'';
|
|
|
|
|
|
2022-09-14 18:05:37 +00:00
|
|
|
|
strictDeps = true;
|
|
|
|
|
|
2020-10-16 20:44:37 +00:00
|
|
|
|
nativeBuildInputs = [
|
2022-09-22 12:36:57 +00:00
|
|
|
|
meson
|
2022-03-30 09:31:56 +00:00
|
|
|
|
docutils
|
2022-09-14 18:05:37 +00:00
|
|
|
|
libxml2 # for xmllint
|
|
|
|
|
libxslt # for xsltproc
|
2022-09-22 12:36:57 +00:00
|
|
|
|
gettext
|
2021-09-18 10:52:07 +00:00
|
|
|
|
makeWrapper
|
2022-03-30 09:31:56 +00:00
|
|
|
|
ninja
|
2021-09-18 10:52:07 +00:00
|
|
|
|
pkg-config
|
2022-09-22 12:36:57 +00:00
|
|
|
|
perl
|
|
|
|
|
perlPackages.XMLXPath
|
2022-03-30 09:31:56 +00:00
|
|
|
|
]
|
2023-02-02 18:25:31 +00:00
|
|
|
|
++ lib.optional (!isDarwin) rpcsvc-proto
|
2022-03-30 09:31:56 +00:00
|
|
|
|
# NOTE: needed for rpcgen
|
2023-02-02 18:25:31 +00:00
|
|
|
|
++ lib.optional isDarwin darwin.developer_cmds;
|
2020-10-16 20:44:37 +00:00
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
|
buildInputs = [
|
2022-09-22 12:36:57 +00:00
|
|
|
|
bash
|
2021-09-18 10:52:07 +00:00
|
|
|
|
bash-completion
|
2022-03-30 09:31:56 +00:00
|
|
|
|
curl
|
|
|
|
|
dbus
|
|
|
|
|
glib
|
2021-09-18 10:52:07 +00:00
|
|
|
|
gnutls
|
2022-03-30 09:31:56 +00:00
|
|
|
|
libgcrypt
|
|
|
|
|
libpcap
|
|
|
|
|
libtasn1
|
|
|
|
|
libxml2
|
2021-09-18 10:52:07 +00:00
|
|
|
|
python3
|
|
|
|
|
readline
|
|
|
|
|
xhtml1
|
2022-03-30 09:31:56 +00:00
|
|
|
|
yajl
|
2023-02-02 18:25:31 +00:00
|
|
|
|
] ++ lib.optionals isLinux [
|
2022-03-30 09:31:56 +00:00
|
|
|
|
acl
|
|
|
|
|
attr
|
2021-09-18 10:52:07 +00:00
|
|
|
|
audit
|
2023-02-02 18:25:31 +00:00
|
|
|
|
fuse3
|
2021-09-18 10:52:07 +00:00
|
|
|
|
libapparmor
|
|
|
|
|
libcap_ng
|
2022-03-30 09:31:56 +00:00
|
|
|
|
libnl
|
|
|
|
|
libpciaccess
|
|
|
|
|
libtirpc
|
|
|
|
|
lvm2
|
2021-09-18 10:52:07 +00:00
|
|
|
|
numactl
|
2022-03-30 09:31:56 +00:00
|
|
|
|
numad
|
2021-09-18 10:52:07 +00:00
|
|
|
|
parted
|
2022-03-30 09:31:56 +00:00
|
|
|
|
systemd
|
|
|
|
|
util-linux
|
2023-02-02 18:25:31 +00:00
|
|
|
|
] ++ lib.optionals isDarwin [
|
2021-12-06 16:07:01 +00:00
|
|
|
|
AppKit
|
2022-03-30 09:31:56 +00:00
|
|
|
|
Carbon
|
|
|
|
|
gmp
|
|
|
|
|
libiconv
|
|
|
|
|
]
|
2023-02-02 18:25:31 +00:00
|
|
|
|
++ lib.optionals enableCeph [ ceph ]
|
|
|
|
|
++ lib.optionals enableGlusterfs [ glusterfs ]
|
|
|
|
|
++ lib.optionals enableIscsi [ libiscsi openiscsi ]
|
|
|
|
|
++ lib.optionals enableXen [ xen ]
|
|
|
|
|
++ lib.optionals enableZfs [ zfs ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
|
preConfigure =
|
|
|
|
|
let
|
|
|
|
|
overrides = {
|
|
|
|
|
QEMU_BRIDGE_HELPER = "/run/wrappers/bin/qemu-bridge-helper";
|
|
|
|
|
QEMU_PR_HELPER = "/run/libvirt/nix-helpers/qemu-pr-helper";
|
|
|
|
|
};
|
2022-03-30 09:31:56 +00:00
|
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
|
patchBuilder = var: value: ''
|
|
|
|
|
sed -i meson.build -e "s|conf.set_quoted('${var}',.*|conf.set_quoted('${var}','${value}')|"
|
|
|
|
|
'';
|
|
|
|
|
in
|
|
|
|
|
''
|
2022-03-30 09:31:56 +00:00
|
|
|
|
PATH="${binPath}:$PATH"
|
2021-09-18 10:52:07 +00:00
|
|
|
|
# the path to qemu-kvm will be stored in VM's .xml and .save files
|
|
|
|
|
# do not use "''${qemu_kvm}/bin/qemu-kvm" to avoid bound VMs to particular qemu derivations
|
|
|
|
|
substituteInPlace src/lxc/lxc_conf.c \
|
|
|
|
|
--replace 'lxc_path,' '"/run/libvirt/nix-emulators/libvirt_lxc",'
|
2022-03-30 09:31:56 +00:00
|
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
|
substituteInPlace build-aux/meson.build \
|
|
|
|
|
--replace "gsed" "sed" \
|
|
|
|
|
--replace "gmake" "make" \
|
|
|
|
|
--replace "ggrep" "grep"
|
2022-03-30 09:31:56 +00:00
|
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
|
substituteInPlace src/util/virpolkit.h \
|
2022-08-12 12:06:08 +00:00
|
|
|
|
--replace '"/usr/bin/pkttyagent"' '"${if isLinux then polkit.bin else "/usr"}/bin/pkttyagent"'
|
2022-04-27 09:35:20 +00:00
|
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
|
substituteInPlace src/util/virpci.c \
|
|
|
|
|
--replace '/lib/modules' '${if isLinux then "/run/booted-system/kernel-modules" else ""}/lib/modules'
|
|
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
|
patchShebangs .
|
|
|
|
|
''
|
|
|
|
|
+ (lib.concatStringsSep "\n" (lib.mapAttrsToList patchBuilder overrides));
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
|
mesonAutoFeatures = "disabled";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
|
mesonFlags =
|
|
|
|
|
let
|
2022-03-30 09:31:56 +00:00
|
|
|
|
cfg = option: val: "-D${option}=${val}";
|
|
|
|
|
feat = option: enable: cfg option (if enable then "enabled" else "disabled");
|
|
|
|
|
driver = name: feat "driver_${name}";
|
|
|
|
|
storage = name: feat "storage_${name}";
|
2021-09-18 10:52:07 +00:00
|
|
|
|
in
|
|
|
|
|
[
|
|
|
|
|
"--sysconfdir=/var/lib"
|
2022-03-30 09:31:56 +00:00
|
|
|
|
(cfg "install_prefix" (placeholder "out"))
|
|
|
|
|
(cfg "localstatedir" "/var")
|
2024-04-21 15:54:59 +00:00
|
|
|
|
(cfg "runstatedir" (if isDarwin then "/var/run" else "/run"))
|
2022-03-30 09:31:56 +00:00
|
|
|
|
|
|
|
|
|
(cfg "init_script" (if isDarwin then "none" else "systemd"))
|
2023-02-16 17:41:37 +00:00
|
|
|
|
(cfg "qemu_datadir" (lib.optionalString isDarwin "${qemu}/share/qemu"))
|
2022-03-30 09:31:56 +00:00
|
|
|
|
|
|
|
|
|
(feat "apparmor" isLinux)
|
|
|
|
|
(feat "attr" isLinux)
|
|
|
|
|
(feat "audit" isLinux)
|
|
|
|
|
(feat "bash_completion" true)
|
|
|
|
|
(feat "blkid" isLinux)
|
|
|
|
|
(feat "capng" isLinux)
|
|
|
|
|
(feat "curl" true)
|
|
|
|
|
(feat "docs" true)
|
|
|
|
|
(feat "expensive_tests" true)
|
|
|
|
|
(feat "firewalld" isLinux)
|
|
|
|
|
(feat "firewalld_zone" isLinux)
|
|
|
|
|
(feat "fuse" isLinux)
|
|
|
|
|
(feat "glusterfs" enableGlusterfs)
|
|
|
|
|
(feat "host_validate" true)
|
|
|
|
|
(feat "libiscsi" enableIscsi)
|
|
|
|
|
(feat "libnl" isLinux)
|
|
|
|
|
(feat "libpcap" true)
|
|
|
|
|
(feat "libssh2" true)
|
|
|
|
|
(feat "login_shell" isLinux)
|
2023-02-22 10:55:15 +00:00
|
|
|
|
(feat "nss" (isLinux && !stdenv.hostPlatform.isMusl))
|
2022-03-30 09:31:56 +00:00
|
|
|
|
(feat "numactl" isLinux)
|
|
|
|
|
(feat "numad" isLinux)
|
|
|
|
|
(feat "pciaccess" isLinux)
|
2022-08-12 12:06:08 +00:00
|
|
|
|
(feat "polkit" isLinux)
|
2022-03-30 09:31:56 +00:00
|
|
|
|
(feat "readline" true)
|
|
|
|
|
(feat "secdriver_apparmor" isLinux)
|
|
|
|
|
(feat "tests" true)
|
|
|
|
|
(feat "udev" isLinux)
|
|
|
|
|
(feat "yajl" true)
|
|
|
|
|
|
|
|
|
|
(driver "ch" isLinux)
|
|
|
|
|
(driver "esx" true)
|
|
|
|
|
(driver "interface" isLinux)
|
|
|
|
|
(driver "libvirtd" true)
|
|
|
|
|
(driver "libxl" enableXen)
|
|
|
|
|
(driver "lxc" isLinux)
|
|
|
|
|
(driver "network" true)
|
|
|
|
|
(driver "openvz" isLinux)
|
|
|
|
|
(driver "qemu" true)
|
|
|
|
|
(driver "remote" true)
|
|
|
|
|
(driver "secrets" true)
|
|
|
|
|
(driver "test" true)
|
|
|
|
|
(driver "vbox" true)
|
|
|
|
|
(driver "vmware" true)
|
|
|
|
|
|
|
|
|
|
(storage "dir" true)
|
|
|
|
|
(storage "disk" isLinux)
|
|
|
|
|
(storage "fs" isLinux)
|
|
|
|
|
(storage "gluster" enableGlusterfs)
|
|
|
|
|
(storage "iscsi" enableIscsi)
|
|
|
|
|
(storage "iscsi_direct" enableIscsi)
|
|
|
|
|
(storage "lvm" isLinux)
|
|
|
|
|
(storage "mpath" isLinux)
|
|
|
|
|
(storage "rbd" enableCeph)
|
|
|
|
|
(storage "scsi" true)
|
|
|
|
|
(storage "vstorage" isLinux)
|
|
|
|
|
(storage "zfs" enableZfs)
|
2021-09-18 10:52:07 +00:00
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
|
doCheck = true;
|
|
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
|
substituteInPlace $out/bin/virt-xml-validate \
|
|
|
|
|
--replace xmllint ${libxml2}/bin/xmllint
|
|
|
|
|
|
|
|
|
|
substituteInPlace $out/libexec/libvirt-guests.sh \
|
|
|
|
|
--replace 'ON_BOOT="start"' 'ON_BOOT=''${ON_BOOT:-start}' \
|
|
|
|
|
--replace 'ON_SHUTDOWN="suspend"' 'ON_SHUTDOWN=''${ON_SHUTDOWN:-suspend}' \
|
2022-12-28 21:21:41 +00:00
|
|
|
|
--replace 'PARALLEL_SHUTDOWN=0' 'PARALLEL_SHUTDOWN=''${PARALLEL_SHUTDOWN:-0}' \
|
2022-03-30 09:31:56 +00:00
|
|
|
|
--replace "$out/bin" '${gettext}/bin' \
|
|
|
|
|
--replace 'lock/subsys' 'lock' \
|
|
|
|
|
--replace 'gettext.sh' 'gettext.sh
|
|
|
|
|
# Added in nixpkgs:
|
|
|
|
|
gettext() { "${gettext}/bin/gettext" "$@"; }
|
|
|
|
|
'
|
2023-02-02 18:25:31 +00:00
|
|
|
|
'' + lib.optionalString isLinux ''
|
2022-04-15 01:41:22 +00:00
|
|
|
|
for f in $out/lib/systemd/system/*.service ; do
|
|
|
|
|
substituteInPlace $f --replace /bin/kill ${coreutils}/bin/kill
|
|
|
|
|
done
|
2022-03-30 09:31:56 +00:00
|
|
|
|
rm $out/lib/systemd/system/{virtlockd,virtlogd}.*
|
|
|
|
|
wrapProgram $out/sbin/libvirtd \
|
|
|
|
|
--prefix PATH : /run/libvirt/nix-emulators:${binPath}
|
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
|
passthru.updateScript = writeScript "update-libvirt" ''
|
|
|
|
|
#!/usr/bin/env nix-shell
|
|
|
|
|
#!nix-shell -i bash -p curl jq common-updater-scripts
|
|
|
|
|
|
|
|
|
|
set -eu -o pipefail
|
|
|
|
|
|
|
|
|
|
libvirtVersion=$(curl https://gitlab.com/api/v4/projects/192693/repository/tags | jq -r '.[].name|select(. | contains("rc") | not)' | head -n1 | sed "s/v//g")
|
|
|
|
|
sysvirtVersion=$(curl https://gitlab.com/api/v4/projects/192677/repository/tags | jq -r '.[].name|select(. | contains("rc") | not)' | head -n1 | sed "s/v//g")
|
|
|
|
|
update-source-version ${pname} "$libvirtVersion"
|
|
|
|
|
update-source-version python3Packages.${pname} "$libvirtVersion"
|
|
|
|
|
update-source-version perlPackages.SysVirt "$sysvirtVersion" --file="pkgs/top-level/perl-packages.nix"
|
|
|
|
|
'';
|
|
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
|
passthru.tests.libvirtd = nixosTests.libvirtd;
|
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
|
description = "Toolkit to interact with the virtualization capabilities of recent versions of Linux and other OSes";
|
2022-12-17 10:02:37 +00:00
|
|
|
|
homepage = "https://libvirt.org/";
|
|
|
|
|
changelog = "https://gitlab.com/libvirt/libvirt/-/raw/v${version}/NEWS.rst";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
license = licenses.lgpl2Plus;
|
|
|
|
|
platforms = platforms.unix;
|
2022-03-30 09:31:56 +00:00
|
|
|
|
maintainers = with maintainers; [ fpletz globin lovesegfault ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
};
|
|
|
|
|
}
|