diff --git a/nixos/doc/manual/development/running-nixos-tests-interactively.xml b/nixos/doc/manual/development/running-nixos-tests-interactively.xml index a11a9382764..a6044d5f89e 100644 --- a/nixos/doc/manual/development/running-nixos-tests-interactively.xml +++ b/nixos/doc/manual/development/running-nixos-tests-interactively.xml @@ -9,7 +9,7 @@ The test itself can be run interactively. This is particularly useful when developing or debugging a test: -$ nix-build nixos/tests/login.nix -A driver +$ nix-build nixos/tests/login.nix -A driverInteractive $ ./result/bin/nixos-test-driver starting VDE switch for network 1 > @@ -30,7 +30,7 @@ starting VDE switch for network 1 To just start and experiment with the VMs, run: -$ nix-build nixos/tests/login.nix -A driver +$ nix-build nixos/tests/login.nix -A driverInteractive $ ./result/bin/nixos-run-vms The script nixos-run-vms starts the virtual machines diff --git a/nixos/lib/testing-python.nix b/nixos/lib/testing-python.nix index 498f97336c0..302c7f78bf8 100644 --- a/nixos/lib/testing-python.nix +++ b/nixos/lib/testing-python.nix @@ -17,9 +17,9 @@ rec { inherit pkgs; - testDriver = let + mkTestDriver = let testDriverScript = ./test-driver/test-driver.py; - in stdenv.mkDerivation { + in qemu_pkg: stdenv.mkDerivation { name = "nixos-test-driver"; nativeBuildInputs = [ makeWrapper ]; @@ -47,10 +47,12 @@ rec { # TODO: copy user script part into this file (append) wrapProgram $out/bin/nixos-test-driver \ - --prefix PATH : "${lib.makeBinPath [ qemu_test vde2 netpbm coreutils ]}" \ + --prefix PATH : "${lib.makeBinPath [ qemu_pkg vde2 netpbm coreutils ]}" \ ''; }; + testDriver = mkTestDriver qemu_test; + testDriverInteractive = mkTestDriver qemu_kvm; # Run an automated test suite in the given virtual network. # `driver' is the script that runs the network. @@ -113,7 +115,11 @@ rec { # Generate convenience wrappers for running the test driver # interactively with the specified network, and for starting the # VMs from the command line. - driver = let warn = if skipLint then lib.warn "Linting is disabled!" else lib.id; in warn (runCommand testDriverName + driver = testDriver: + let + warn = if skipLint then lib.warn "Linting is disabled!" else lib.id; + in + warn (runCommand testDriverName { buildInputs = [ makeWrapper]; testScript = testScript'; preferLocalBuild = true; @@ -148,7 +154,7 @@ rec { meta = (drv.meta or {}) // t.meta; }; - test = passMeta (runTests driver); + test = passMeta (runTests (driver testDriver)); nodeNames = builtins.attrNames nodes; invalidNodeNames = lib.filter @@ -165,7 +171,9 @@ rec { '' else test // { - inherit nodes driver test; + inherit nodes test; + driver = driver testDriver; + driverInteractive = driver testDriverInteractive; }; runInMachine = diff --git a/nixos/modules/testing/test-instrumentation.nix b/nixos/modules/testing/test-instrumentation.nix index c0ec76e8a3a..dbbcb0bed5b 100644 --- a/nixos/modules/testing/test-instrumentation.nix +++ b/nixos/modules/testing/test-instrumentation.nix @@ -116,6 +116,10 @@ with import ../../lib/qemu-flags.nix { inherit pkgs; }; users.users.root.initialHashedPassword = mkOverride 150 ""; services.xserver.displayManager.job.logToJournal = true; + + # Make sure we use the Guest Agent from the QEMU package for testing + # to reduce the closure size required for the tests. + services.qemuGuest.package = pkgs.qemu_test.ga; }; } diff --git a/nixos/modules/virtualisation/qemu-guest-agent.nix b/nixos/modules/virtualisation/qemu-guest-agent.nix index 665224e35d8..6a735f451a7 100644 --- a/nixos/modules/virtualisation/qemu-guest-agent.nix +++ b/nixos/modules/virtualisation/qemu-guest-agent.nix @@ -12,6 +12,11 @@ in { default = false; description = "Whether to enable the qemu guest agent."; }; + package = mkOption { + type = types.package; + default = pkgs.qemu.ga; + description = "The QEMU guest agent package."; + }; }; config = mkIf cfg.enable ( @@ -25,7 +30,7 @@ in { systemd.services.qemu-guest-agent = { description = "Run the QEMU Guest Agent"; serviceConfig = { - ExecStart = "${pkgs.qemu.ga}/bin/qemu-ga"; + ExecStart = "${cfg.package}/bin/qemu-ga"; Restart = "always"; RestartSec = 0; }; diff --git a/pkgs/applications/virtualization/qemu/default.nix b/pkgs/applications/virtualization/qemu/default.nix index 535f8371153..3c867205799 100644 --- a/pkgs/applications/virtualization/qemu/default.nix +++ b/pkgs/applications/virtualization/qemu/default.nix @@ -1,17 +1,19 @@ { stdenv, fetchurl, fetchpatch, python, zlib, pkgconfig, glib -, ncurses, perl, pixman, vde2, alsaLib, texinfo, flex +, perl, pixman, vde2, alsaLib, texinfo, flex , bison, lzo, snappy, libaio, gnutls, nettle, curl , makeWrapper , attr, libcap, libcap_ng , CoreServices, Cocoa, Hypervisor, rez, setfile , numaSupport ? stdenv.isLinux && !stdenv.isAarch32, numactl , seccompSupport ? stdenv.isLinux, libseccomp -, pulseSupport ? !stdenv.isDarwin, libpulseaudio -, sdlSupport ? !stdenv.isDarwin, SDL2 -, gtkSupport ? !stdenv.isDarwin && !xenSupport, gtk3, gettext, vte, wrapGAppsHook -, vncSupport ? true, libjpeg, libpng -, smartcardSupport ? true, libcacard -, spiceSupport ? !stdenv.isDarwin, spice, spice-protocol +, alsaSupport ? stdenv.lib.hasSuffix "linux" stdenv.hostPlatform.system && !nixosTestRunner +, pulseSupport ? !stdenv.isDarwin && !nixosTestRunner, libpulseaudio +, sdlSupport ? !stdenv.isDarwin && !nixosTestRunner, SDL2 +, gtkSupport ? !stdenv.isDarwin && !xenSupport && !nixosTestRunner, gtk3, gettext, vte, wrapGAppsHook +, vncSupport ? !nixosTestRunner, libjpeg, libpng +, smartcardSupport ? !nixosTestRunner, libcacard +, spiceSupport ? !stdenv.isDarwin && !nixosTestRunner, spice, spice-protocol +, ncursesSupport ? !nixosTestRunner, ncurses , usbredirSupport ? spiceSupport, usbredir , xenSupport ? false, xen , cephSupport ? false, ceph @@ -29,7 +31,7 @@ with stdenv.lib; let - audio = optionalString (hasSuffix "linux" stdenv.hostPlatform.system) "alsa," + audio = optionalString alsaSupport "alsa," + optionalString pulseSupport "pa," + optionalString sdlSupport "sdl,"; @@ -50,10 +52,11 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ python python.pkgs.sphinx pkgconfig flex bison ] ++ optionals gtkSupport [ wrapGAppsHook ]; buildInputs = - [ zlib glib ncurses perl pixman + [ zlib glib perl pixman vde2 texinfo makeWrapper lzo snappy gnutls nettle curl ] + ++ optionals ncursesSupport [ ncurses ] ++ optionals stdenv.isDarwin [ CoreServices Cocoa Hypervisor rez setfile ] ++ optionals seccompSupport [ libseccomp ] ++ optionals numaSupport [ numactl ] diff --git a/pkgs/development/libraries/libndctl/default.nix b/pkgs/development/libraries/libndctl/default.nix index 7c4c49baffa..be5c75806d8 100644 --- a/pkgs/development/libraries/libndctl/default.nix +++ b/pkgs/development/libraries/libndctl/default.nix @@ -1,6 +1,6 @@ { stdenv, fetchFromGitHub, autoreconfHook , asciidoctor, pkgconfig, xmlto, docbook_xsl, docbook_xml_dtd_45, libxslt -, json_c, kmod, which, utillinux, systemd, keyutils +, json_c, kmod, which, utillinux, udev, keyutils }: stdenv.mkDerivation rec { @@ -22,7 +22,7 @@ stdenv.mkDerivation rec { ]; buildInputs = - [ json_c kmod utillinux systemd keyutils + [ json_c kmod utillinux udev keyutils ]; configureFlags = diff --git a/pkgs/os-specific/linux/iputils/default.nix b/pkgs/os-specific/linux/iputils/default.nix index e12c44888a0..3bb653ebcf7 100644 --- a/pkgs/os-specific/linux/iputils/default.nix +++ b/pkgs/os-specific/linux/iputils/default.nix @@ -1,6 +1,6 @@ -{ stdenv, fetchFromGitHub +{ stdenv, fetchFromGitHub, fetchpatch , meson, ninja, pkgconfig, gettext, libxslt, docbook_xsl_ns -, libcap, systemd, libidn2 +, libcap, libidn2 }: with stdenv.lib; @@ -22,18 +22,27 @@ in stdenv.mkDerivation rec { sha256 = "1jhbcz75a4ij1myyyi110ma1d8d5hpm3scz9pyw7js6qym50xvh4"; }; + patches = [ + # Proposed upstream patch to reduce dependency on systemd: https://github.com/iputils/iputils/pull/297 + (fetchpatch { + url = "https://github.com/iputils/iputils/commit/13d6aefd57fd471ecad06e19073dcc44608dff5e.patch"; + sha256 = "1n62zxmzp7hgz9qapbbpqv3fxqvc3qyd2a73jhp357x6by84kj49"; + }) + ]; + mesonFlags = [ "-DBUILD_RARPD=true" "-DBUILD_TRACEROUTE6=true" "-DBUILD_TFTPD=true" "-DNO_SETCAP_OR_SUID=true" "-Dsystemdunitdir=etc/systemd/system" + "-DINSTALL_SYSTEMD_UNITS=true" ] # Disable idn usage w/musl (https://github.com/iputils/iputils/pull/111): ++ optional stdenv.hostPlatform.isMusl "-DUSE_IDN=false"; nativeBuildInputs = [ meson ninja pkgconfig gettext libxslt.bin docbook_xsl_ns ]; - buildInputs = [ libcap systemd ] + buildInputs = [ libcap ] ++ optional (!stdenv.hostPlatform.isMusl) libidn2; meta = {