1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-09-19 23:03:53 -04:00
nix/tests/unit/libexpr/package.nix

99 lines
1.7 KiB
Nix
Raw Normal View History

2024-06-27 17:44:34 -04:00
{ lib
, stdenv
2024-07-01 14:36:46 -04:00
, mkMesonDerivation
2024-06-27 17:44:34 -04:00
, releaseTools
, meson
, ninja
, pkg-config
, nix-expr
, nix-expr-c
, nix-expr-test-support
, rapidcheck
, gtest
, runCommand
# Configuration Options
2024-07-06 11:36:31 -04:00
, version
2024-06-27 17:44:34 -04:00
}:
let
inherit (lib) fileset;
in
2024-07-01 14:36:46 -04:00
mkMesonDerivation (finalAttrs: {
pname = "nix-expr-tests";
2024-06-27 17:44:34 -04:00
inherit version;
2024-07-01 14:36:46 -04:00
workDir = ./.;
fileset = fileset.unions [
../../../build-utils-meson
2024-07-01 14:36:46 -04:00
./build-utils-meson
../../../.version
2024-07-01 14:36:46 -04:00
./.version
./meson.build
# ./meson.options
(fileset.fileFilter (file: file.hasExt "cc") ./.)
(fileset.fileFilter (file: file.hasExt "hh") ./.)
];
2024-06-27 17:44:34 -04:00
outputs = [ "out" "dev" ];
nativeBuildInputs = [
meson
ninja
pkg-config
];
buildInputs = [
nix-expr
nix-expr-c
nix-expr-test-support
rapidcheck
gtest
];
preConfigure =
2024-06-27 19:19:32 -04:00
# "Inline" .version so it's not a symlink, and includes the suffix.
# Do the meson utils, without modification.
2024-06-27 17:44:34 -04:00
''
2024-07-01 14:36:46 -04:00
chmod u+w ./.version
echo ${version} > ../../../.version
2024-06-27 17:44:34 -04:00
'';
mesonFlags = [
];
env = lib.optionalAttrs (stdenv.isLinux && !(stdenv.hostPlatform.isStatic && stdenv.system == "aarch64-linux")) {
LDFLAGS = "-fuse-ld=gold";
};
enableParallelBuilding = true;
separateDebugInfo = !stdenv.hostPlatform.isStatic;
2024-07-01 14:36:46 -04:00
strictDeps = true;
2024-06-27 17:44:34 -04:00
hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie";
passthru = {
tests = {
run = runCommand "${finalAttrs.pname}-run" {
} ''
PATH="${lib.makeBinPath [ finalAttrs.finalPackage ]}:$PATH"
export _NIX_TEST_UNIT_DATA=${./data}
nix-expr-tests
2024-06-27 17:44:34 -04:00
touch $out
'';
};
};
meta = {
platforms = lib.platforms.unix ++ lib.platforms.windows;
};
})