mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-24 23:06:16 +02:00
99 lines
1.9 KiB
Nix
99 lines
1.9 KiB
Nix
{ lib
|
|
, stdenv
|
|
, releaseTools
|
|
|
|
, meson
|
|
, ninja
|
|
, pkg-config
|
|
|
|
, nix-util
|
|
|
|
, rapidcheck
|
|
|
|
# Configuration Options
|
|
|
|
, versionSuffix ? ""
|
|
|
|
# Check test coverage of Nix. Probably want to use with at least
|
|
# one of `doCheck` or `doInstallCheck` enabled.
|
|
, withCoverageChecks ? false
|
|
}:
|
|
|
|
let
|
|
inherit (lib) fileset;
|
|
|
|
version = lib.fileContents ./.version + versionSuffix;
|
|
|
|
mkDerivation =
|
|
if withCoverageChecks
|
|
then
|
|
# TODO support `finalAttrs` args function in
|
|
# `releaseTools.coverageAnalysis`.
|
|
argsFun:
|
|
releaseTools.coverageAnalysis (let args = argsFun args; in args)
|
|
else stdenv.mkDerivation;
|
|
in
|
|
|
|
mkDerivation (finalAttrs: {
|
|
pname = "nix-util-test-support";
|
|
inherit version;
|
|
|
|
src = fileset.toSource {
|
|
root = ./.;
|
|
fileset = fileset.unions [
|
|
./meson.build
|
|
# ./meson.options
|
|
(fileset.fileFilter (file: file.hasExt "cc") ./.)
|
|
(fileset.fileFilter (file: file.hasExt "hh") ./.)
|
|
];
|
|
};
|
|
|
|
outputs = [ "out" "dev" ];
|
|
|
|
nativeBuildInputs = [
|
|
meson
|
|
ninja
|
|
pkg-config
|
|
];
|
|
|
|
buildInputs = [
|
|
nix-util
|
|
rapidcheck
|
|
]
|
|
;
|
|
|
|
propagatedBuildInputs = [
|
|
nix-util
|
|
];
|
|
|
|
preConfigure =
|
|
# "Inline" .version so it's not a symlink, and includes the suffix
|
|
''
|
|
echo ${version} > .version
|
|
'';
|
|
|
|
mesonFlags = [
|
|
];
|
|
|
|
env = lib.optionalAttrs (stdenv.isLinux && !(stdenv.hostPlatform.isStatic && stdenv.system == "aarch64-linux")) {
|
|
LDFLAGS = "-fuse-ld=gold";
|
|
};
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
separateDebugInfo = !stdenv.hostPlatform.isStatic;
|
|
|
|
# TODO Always true after https://github.com/NixOS/nixpkgs/issues/318564
|
|
strictDeps = !withCoverageChecks;
|
|
|
|
hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie";
|
|
|
|
meta = {
|
|
platforms = lib.platforms.unix ++ lib.platforms.windows;
|
|
};
|
|
|
|
} // lib.optionalAttrs withCoverageChecks {
|
|
lcovFilter = [ "*/boost/*" "*-tab.*" ];
|
|
|
|
hardeningDisable = [ "fortify" ];
|
|
})
|