nixos-mailserver/tests/lib/pkgs.nokvm.nix
Antoine Eiche a53aa5ac9a Use Niv to pin nixpkgs releases
Before using Niv, we were following channels meaning we can not
reproduce CI jobs easily.

In this change, we use Niv to pin these dependencies. We are also
addding a tests/default.nix to be able to run these tests locally.

For instance, to run the test extern.nix on the nixpkgs-19.09 release:

    nix-build tests/default.nix -A extern.nixpkgs_19_09

Fixes #178
2020-04-19 10:01:57 +02:00

32 lines
1.1 KiB
Nix

{ pkgs }:
let
patchedMachinePM = pkgs.writeTextFile {
name = "Machine.pm.patched-to-wait-longer-for-vm";
text = builtins.replaceStrings ["alarm 600;"] ["alarm 1200;"] (builtins.readFile (<nixpkgs>+"/nixos/lib/test-driver/Machine.pm"));
};
in
(pkgs // {
qemu_test = with pkgs; stdenv.mkDerivation {
name = "qemu_test_no_kvm";
buildInputs = [ coreutils qemu_test ];
inherit qemu_test;
inherit coreutils;
builder = builtins.toFile "builder.sh" ''
PATH=$coreutils/bin:$PATH
mkdir -p $out/bin
cp $qemu_test/bin/* $out/bin/
ln -sf $out/bin/qemu-system-${stdenv.hostPlatform.qemuArch} $out/bin/qemu-kvm
'';
};
stdenv = pkgs.stdenv // {
mkDerivation = args: (pkgs.stdenv.mkDerivation (args // (
pkgs.lib.optionalAttrs (args.name == "nixos-test-driver") {
installPhase = args.installPhase + ''
rm $libDir/Machine.pm
cp ${patchedMachinePM} $libDir/Machine.pm
'';
}
)));
};
})