2024-07-08 20:07:06 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, mkMesonDerivation
|
|
|
|
|
|
|
|
, meson
|
|
|
|
, ninja
|
|
|
|
, pkg-config
|
|
|
|
|
|
|
|
, jq
|
|
|
|
, git
|
|
|
|
, mercurial
|
|
|
|
, util-linux
|
|
|
|
|
|
|
|
, nix-store
|
|
|
|
, nix-expr
|
2024-08-14 20:04:35 +00:00
|
|
|
, nix-cli
|
2024-07-08 20:07:06 +00:00
|
|
|
|
|
|
|
, busybox-sandbox-shell ? null
|
|
|
|
|
|
|
|
# Configuration Options
|
|
|
|
|
2024-11-04 17:15:41 +00:00
|
|
|
, pname ? "nix-functional-tests"
|
2024-07-08 20:07:06 +00:00
|
|
|
, version
|
|
|
|
|
|
|
|
# For running the functional tests against a different pre-built Nix.
|
|
|
|
, test-daemon ? null
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
inherit (lib) fileset;
|
|
|
|
in
|
|
|
|
|
|
|
|
mkMesonDerivation (finalAttrs: {
|
2024-11-04 17:15:41 +00:00
|
|
|
inherit pname version;
|
2024-07-08 20:07:06 +00:00
|
|
|
|
|
|
|
workDir = ./.;
|
|
|
|
fileset = fileset.unions [
|
|
|
|
../../scripts/nix-profile.sh.in
|
|
|
|
../../.version
|
|
|
|
../../tests/functional
|
|
|
|
./.
|
|
|
|
];
|
|
|
|
|
|
|
|
# Hack for sake of the dev shell
|
2024-10-09 14:39:18 +00:00
|
|
|
passthru.externalNativeBuildInputs = [
|
2024-07-08 20:07:06 +00:00
|
|
|
meson
|
|
|
|
ninja
|
|
|
|
pkg-config
|
|
|
|
|
|
|
|
jq
|
|
|
|
git
|
|
|
|
mercurial
|
|
|
|
] ++ lib.optionals stdenv.hostPlatform.isLinux [
|
|
|
|
# For various sandboxing tests that needs a statically-linked shell,
|
|
|
|
# etc.
|
|
|
|
busybox-sandbox-shell
|
|
|
|
# For Overlay FS tests need `mount`, `umount`, and `unshare`.
|
2024-11-06 14:05:32 +00:00
|
|
|
# For `script` command (ensuring a TTY)
|
2024-07-08 20:07:06 +00:00
|
|
|
# TODO use `unixtools` to be precise over which executables instead?
|
|
|
|
util-linux
|
|
|
|
];
|
|
|
|
|
2024-10-09 14:39:18 +00:00
|
|
|
nativeBuildInputs = finalAttrs.passthru.externalNativeBuildInputs ++ [
|
2024-08-14 20:04:35 +00:00
|
|
|
nix-cli
|
2024-07-08 20:07:06 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
nix-store
|
|
|
|
nix-expr
|
|
|
|
];
|
|
|
|
|
|
|
|
preConfigure =
|
|
|
|
# "Inline" .version so it's not a symlink, and includes the suffix.
|
|
|
|
# Do the meson utils, without modification.
|
|
|
|
''
|
|
|
|
chmod u+w ./.version
|
|
|
|
echo ${version} > ../../../.version
|
|
|
|
''
|
|
|
|
# TEMP hack for Meson before make is gone, where
|
|
|
|
# `src/nix-functional-tests` is during the transition a symlink and
|
|
|
|
# not the actual directory directory.
|
|
|
|
+ ''
|
|
|
|
cd $(readlink -e $PWD)
|
|
|
|
echo $PWD | grep tests/functional
|
|
|
|
'';
|
|
|
|
|
|
|
|
mesonCheckFlags = [
|
|
|
|
"--print-errorlogs"
|
|
|
|
];
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
|
|
|
installPhase = ''
|
2024-08-14 20:04:35 +00:00
|
|
|
mkdir $out
|
2024-07-08 20:07:06 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
platforms = lib.platforms.unix;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // lib.optionalAttrs (test-daemon != null) {
|
|
|
|
NIX_DAEMON_PACKAGE = test-daemon;
|
|
|
|
})
|