asterinas/test/nix/default.nix

57 lines
1.8 KiB
Nix
Raw Normal View History

2025-07-17 09:37:02 +00:00
{ target ? "x86_64", enableBasicTest ? false, enableBenchmark ? false
, enableSyscallTest ? false, syscallTestSuite ? "ltp"
, syscallTestWorkDir ? "/tmp", smp ? 1, initramfsCompressed ? true, }:
2025-07-02 07:08:15 +00:00
let
crossSystem.config = if target == "x86_64" then
"x86_64-unknown-linux-gnu"
else if target == "riscv64" then
"riscv64-unknown-linux-gnu"
else
throw "Target arch ${target} not yet supported.";
2025-07-07 03:39:38 +00:00
# Pinned nixpkgs (nix version: 2.29.1, channel: nixos-25.05, release date: 2025-07-01)
2025-07-17 09:40:41 +00:00
nixpkgs = fetchTarball {
url =
"https://github.com/NixOS/nixpkgs/archive/c0bebd16e69e631ac6e52d6eb439daba28ac50cd.tar.gz";
sha256 = "1fbhkqm8cnsxszw4d4g0402vwsi75yazxkpfx3rdvln4n6s68saf";
};
2025-07-02 07:08:15 +00:00
pkgs = import nixpkgs {
config = { };
overlays = [ ];
inherit crossSystem;
};
in rec {
# Packages needed by initramfs
2025-07-04 08:37:47 +00:00
apps = pkgs.callPackage ./apps.nix { };
2025-07-02 07:08:15 +00:00
busybox = pkgs.busybox;
benchmark = pkgs.callPackage ./benchmark { };
2025-07-04 08:37:47 +00:00
syscall = pkgs.callPackage ./syscall {
inherit smp;
testSuite = syscallTestSuite;
workDir = syscallTestWorkDir;
};
initramfs = pkgs.callPackage ./initramfs.nix {
2025-08-22 08:55:15 +00:00
inherit busybox;
2025-07-17 09:37:02 +00:00
apps = if enableBasicTest then apps else null;
2025-07-04 08:37:47 +00:00
benchmark = if enableBenchmark then benchmark else null;
syscall = if enableSyscallTest then syscall else null;
};
initramfs-image = pkgs.callPackage ./initramfs-image.nix {
inherit initramfs;
compressed = initramfsCompressed;
};
2025-07-02 07:08:15 +00:00
# Packages needed by host
apacheHttpd = pkgs.apacheHttpd;
iperf3 = pkgs.iperf3;
libmemcached = pkgs.libmemcached.overrideAttrs (_: {
configureFlags = [ "--enable-memaslap" ];
LDFLAGS = "-lpthread";
CPPFLAGS = "-fcommon -fpermissive";
});
lmbench = pkgs.callPackage ./benchmark/lmbench.nix { };
redis = (pkgs.redis.overrideAttrs (_: { doCheck = false; })).override {
withSystemd = false;
};
}