1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 14:51:16 +02:00

Fix things

This commit is contained in:
John Ericson 2024-07-01 14:36:46 -04:00
parent 4727d5c3c5
commit 4d6bc61b8d
16 changed files with 258 additions and 497 deletions

View file

@ -1,5 +1,6 @@
{ lib
, stdenv
, mkMesonDerivation
, releaseTools
, meson
@ -21,10 +22,6 @@
, versionSuffix ? ""
# Check test coverage of Nix. Probably want to use with at least
# one of `doCheck` or `doInstallCheck` enabled.
, withCoverageChecks ? false
# Whether to use garbage collection for the Nix language evaluator.
#
# If it is disabled, we just leak memory, but this is not as bad as it
@ -41,34 +38,27 @@ 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: {
mkMesonDerivation (finalAttrs: {
pname = "nix-expr";
inherit version;
src = fileset.toSource {
root = ./.;
fileset = fileset.unions [
./meson.build
./meson.options
./primops/meson.build
(fileset.fileFilter (file: file.hasExt "cc") ./.)
(fileset.fileFilter (file: file.hasExt "hh") ./.)
./lexer.l
./parser.y
(fileset.fileFilter (file: file.hasExt "nix") ./.)
];
};
workDir = ./.;
fileset = fileset.unions [
../../build-utils-meson
./build-utils-meson
../../.version
./.version
./meson.build
./meson.options
./primops/meson.build
(fileset.fileFilter (file: file.hasExt "cc") ./.)
(fileset.fileFilter (file: file.hasExt "hh") ./.)
./lexer.l
./parser.y
(fileset.fileFilter (file: file.hasExt "nix") ./.)
];
outputs = [ "out" "dev" ];
@ -97,8 +87,8 @@ mkDerivation (finalAttrs: {
# "Inline" .version so it's not a symlink, and includes the suffix.
# Do the meson utils, without modification.
''
echo ${version} > .version
cp -r ${../../build-utils-meson} build-utils-meson
chmod u+w ./.version
echo ${version} > ../../.version
'';
mesonFlags = [
@ -118,8 +108,7 @@ mkDerivation (finalAttrs: {
separateDebugInfo = !stdenv.hostPlatform.isStatic;
# TODO Always true after https://github.com/NixOS/nixpkgs/issues/318564
strictDeps = !withCoverageChecks;
strictDeps = true;
hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie";
@ -127,8 +116,4 @@ mkDerivation (finalAttrs: {
platforms = lib.platforms.unix ++ lib.platforms.windows;
};
} // lib.optionalAttrs withCoverageChecks {
lcovFilter = [ "*/boost/*" "*-tab.*" ];
hardeningDisable = [ "fortify" ];
})