asterinas/test/initramfs/nix/regression/default.nix

43 lines
1.3 KiB
Nix

{ lib, pkgs, stdenv, callPackage, testPlatform ? "asterinas", }: rec {
scripts = lib.fileset.toSource {
root = ./../../src/regression/scripts;
fileset = lib.fileset.fileFilter (file: file.hasExt "sh")
./../../src/regression/scripts;
};
allPkgs = lib.listToAttrs (map (dir: {
name = dir;
value = callPackage ./common.nix { inherit dir testPlatform; };
}) [ "device" "fs" "hello_world" "io" "ipc" "memory" "process" "security" ])
// {
network = callPackage ./common.nix {
dir = "network";
inherit testPlatform;
extraEnv = { C_FLAGS = " -I${pkgs.libnl.dev}/include/libnl3"; };
extraBuildInputs = [ pkgs.libnl ];
};
} // lib.optionalAttrs (pkgs.hostPlatform.system == "x86_64-linux") {
intel_tdx = callPackage ./common.nix {
dir = "intel_tdx";
inherit testPlatform;
extraEnv = {
TDX_ATTEST_DIR =
"${callPackage ./tdx-attest.nix { }}/QuoteGeneration";
};
};
};
package = stdenv.mkDerivation {
pname = "regression";
version = "0.1.0";
buildCommand = ''
mkdir -p $out
cp ${scripts}/* $out
${lib.concatMapStringsSep "\n"
(name: "ln -s ${toString allPkgs.${name}}/${name} $out/${name}")
(lib.attrNames allPkgs)}
'';
};
}