Deduplicate our many package.nix a bit (#11175)

- They should all be built in parallel

- They should all use strict deps by default
This commit is contained in:
John Ericson 2024-07-24 23:12:39 -04:00 committed by GitHub
parent a2fed6db9e
commit 3b49f7a143
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 21 additions and 106 deletions

View file

@ -63,9 +63,16 @@ let
# Work around weird `--as-needed` linker behavior with BSD, see # Work around weird `--as-needed` linker behavior with BSD, see
# https://github.com/mesonbuild/meson/issues/3593 # https://github.com/mesonbuild/meson/issues/3593
bsdNoLinkAsNeeded = finalAttrs: prevAttrs: lib.optionalAttrs stdenv.hostPlatform.isBSD { bsdNoLinkAsNeeded = finalAttrs: prevAttrs:
mesonFlags = [ (lib.mesonBool "b_asneeded" false) ] ++ prevAttrs.mesonFlags or []; lib.optionalAttrs stdenv.hostPlatform.isBSD {
}; mesonFlags = [ (lib.mesonBool "b_asneeded" false) ] ++ prevAttrs.mesonFlags or [];
};
miscGoodPractice = finalAttrs: prevAttrs:
{
strictDeps = prevAttrs.strictDeps or true;
enableParallelBuilding = true;
};
in in
scope: { scope: {
@ -136,8 +143,14 @@ scope: {
inherit resolvePath filesetToSource; inherit resolvePath filesetToSource;
mkMesonDerivation = f: stdenv.mkDerivation mkMesonDerivation = f: let
(lib.extends exts = [
(lib.composeExtensions bsdNoLinkAsNeeded localSourceLayer) miscGoodPractice
f); bsdNoLinkAsNeeded
localSourceLayer
];
in stdenv.mkDerivation
(lib.extends
(lib.foldr lib.composeExtensions (_: _: {}) exts)
f);
} }

View file

@ -53,10 +53,6 @@ mkMesonDerivation (finalAttrs: {
echo "doc external-api-docs $out/share/doc/nix/external-api/html" >> ''${!outputDoc}/nix-support/hydra-build-products echo "doc external-api-docs $out/share/doc/nix/external-api/html" >> ''${!outputDoc}/nix-support/hydra-build-products
''; '';
enableParallelBuilding = true;
strictDeps = true;
meta = { meta = {
platforms = lib.platforms.all; platforms = lib.platforms.all;
}; };

View file

@ -48,10 +48,6 @@ mkMesonDerivation (finalAttrs: {
echo "doc internal-api-docs $out/share/doc/nix/internal-api/html" >> ''${!outputDoc}/nix-support/hydra-build-products echo "doc internal-api-docs $out/share/doc/nix/internal-api/html" >> ''${!outputDoc}/nix-support/hydra-build-products
''; '';
enableParallelBuilding = true;
strictDeps = true;
meta = { meta = {
platforms = lib.platforms.all; platforms = lib.platforms.all;
}; };

View file

@ -93,14 +93,8 @@ mkMesonDerivation (finalAttrs: {
LDFLAGS = "-fuse-ld=gold"; LDFLAGS = "-fuse-ld=gold";
}; };
enableParallelBuilding = true;
separateDebugInfo = !stdenv.hostPlatform.isStatic; separateDebugInfo = !stdenv.hostPlatform.isStatic;
# TODO `releaseTools.coverageAnalysis` in Nixpkgs needs to be updated
# to work with `strictDeps`.
strictDeps = true;
hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie";
meta = { meta = {

View file

@ -63,12 +63,8 @@ mkMesonDerivation (finalAttrs: {
LDFLAGS = "-fuse-ld=gold"; LDFLAGS = "-fuse-ld=gold";
}; };
enableParallelBuilding = true;
separateDebugInfo = !stdenv.hostPlatform.isStatic; separateDebugInfo = !stdenv.hostPlatform.isStatic;
strictDeps = true;
hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie";
meta = { meta = {

View file

@ -102,12 +102,8 @@ mkMesonDerivation (finalAttrs: {
LDFLAGS = "-fuse-ld=gold"; LDFLAGS = "-fuse-ld=gold";
}; };
enableParallelBuilding = true;
separateDebugInfo = !stdenv.hostPlatform.isStatic; separateDebugInfo = !stdenv.hostPlatform.isStatic;
strictDeps = true;
hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie";
meta = { meta = {

View file

@ -67,14 +67,8 @@ mkMesonDerivation (finalAttrs: {
LDFLAGS = "-fuse-ld=gold"; LDFLAGS = "-fuse-ld=gold";
}; };
enableParallelBuilding = true;
separateDebugInfo = !stdenv.hostPlatform.isStatic; separateDebugInfo = !stdenv.hostPlatform.isStatic;
# TODO `releaseTools.coverageAnalysis` in Nixpkgs needs to be updated
# to work with `strictDeps`.
strictDeps = true;
hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie";
meta = { meta = {

View file

@ -67,14 +67,8 @@ mkMesonDerivation (finalAttrs: {
LDFLAGS = "-fuse-ld=gold"; LDFLAGS = "-fuse-ld=gold";
}; };
enableParallelBuilding = true;
separateDebugInfo = !stdenv.hostPlatform.isStatic; separateDebugInfo = !stdenv.hostPlatform.isStatic;
# TODO `releaseTools.coverageAnalysis` in Nixpkgs needs to be updated
# to work with `strictDeps`.
strictDeps = true;
hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie";
meta = { meta = {

View file

@ -68,12 +68,8 @@ mkMesonDerivation (finalAttrs: {
LDFLAGS = "-fuse-ld=gold"; LDFLAGS = "-fuse-ld=gold";
}; };
enableParallelBuilding = true;
separateDebugInfo = !stdenv.hostPlatform.isStatic; separateDebugInfo = !stdenv.hostPlatform.isStatic;
strictDeps = true;
hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie";
meta = { meta = {

View file

@ -62,14 +62,8 @@ mkMesonDerivation (finalAttrs: {
LDFLAGS = "-fuse-ld=gold"; LDFLAGS = "-fuse-ld=gold";
}; };
enableParallelBuilding = true;
separateDebugInfo = !stdenv.hostPlatform.isStatic; separateDebugInfo = !stdenv.hostPlatform.isStatic;
# TODO `releaseTools.coverageAnalysis` in Nixpkgs needs to be updated
# to work with `strictDeps`.
strictDeps = true;
hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie";
meta = { meta = {

View file

@ -64,12 +64,8 @@ mkMesonDerivation (finalAttrs: {
LDFLAGS = "-fuse-ld=gold"; LDFLAGS = "-fuse-ld=gold";
}; };
enableParallelBuilding = true;
separateDebugInfo = !stdenv.hostPlatform.isStatic; separateDebugInfo = !stdenv.hostPlatform.isStatic;
strictDeps = true;
hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie";
meta = { meta = {

View file

@ -101,12 +101,8 @@ mkMesonDerivation (finalAttrs: {
LDFLAGS = "-fuse-ld=gold"; LDFLAGS = "-fuse-ld=gold";
}; };
enableParallelBuilding = true;
separateDebugInfo = !stdenv.hostPlatform.isStatic; separateDebugInfo = !stdenv.hostPlatform.isStatic;
strictDeps = true;
hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie";
meta = { meta = {

View file

@ -62,12 +62,8 @@ mkMesonDerivation (finalAttrs: {
LDFLAGS = "-fuse-ld=gold"; LDFLAGS = "-fuse-ld=gold";
}; };
enableParallelBuilding = true;
separateDebugInfo = !stdenv.hostPlatform.isStatic; separateDebugInfo = !stdenv.hostPlatform.isStatic;
strictDeps = true;
hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie";
meta = { meta = {

View file

@ -88,12 +88,8 @@ mkMesonDerivation (finalAttrs: {
LDFLAGS = "-fuse-ld=gold"; LDFLAGS = "-fuse-ld=gold";
}; };
enableParallelBuilding = true;
separateDebugInfo = !stdenv.hostPlatform.isStatic; separateDebugInfo = !stdenv.hostPlatform.isStatic;
strictDeps = true;
hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie";
meta = { meta = {

View file

@ -84,8 +84,6 @@ mkMesonDerivation (finalAttrs: {
] ]
); );
outputs = [ "out" "dev" ];
nativeBuildInputs = [ nativeBuildInputs = [
meson meson
ninja ninja
@ -114,12 +112,8 @@ mkMesonDerivation (finalAttrs: {
LDFLAGS = "-fuse-ld=gold"; LDFLAGS = "-fuse-ld=gold";
}; };
enableParallelBuilding = true;
separateDebugInfo = !stdenv.hostPlatform.isStatic; separateDebugInfo = !stdenv.hostPlatform.isStatic;
strictDeps = true;
hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie";
meta = { meta = {

View file

@ -73,5 +73,5 @@ perl.pkgs.toPerlModule (mkMesonDerivation (finalAttrs: {
"--print-errorlogs" "--print-errorlogs"
]; ];
enableParallelBuilding = true; strictDeps = false;
})) }))

View file

@ -66,12 +66,8 @@ mkMesonDerivation (finalAttrs: {
LDFLAGS = "-fuse-ld=gold"; LDFLAGS = "-fuse-ld=gold";
}; };
enableParallelBuilding = true;
separateDebugInfo = !stdenv.hostPlatform.isStatic; separateDebugInfo = !stdenv.hostPlatform.isStatic;
strictDeps = true;
hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie";
meta = { meta = {

View file

@ -71,12 +71,8 @@ mkMesonDerivation (finalAttrs: {
LDFLAGS = "-fuse-ld=gold"; LDFLAGS = "-fuse-ld=gold";
}; };
enableParallelBuilding = true;
separateDebugInfo = !stdenv.hostPlatform.isStatic; separateDebugInfo = !stdenv.hostPlatform.isStatic;
strictDeps = true;
hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie";
passthru = { passthru = {

View file

@ -69,12 +69,8 @@ mkMesonDerivation (finalAttrs: {
LDFLAGS = "-fuse-ld=gold"; LDFLAGS = "-fuse-ld=gold";
}; };
enableParallelBuilding = true;
separateDebugInfo = !stdenv.hostPlatform.isStatic; separateDebugInfo = !stdenv.hostPlatform.isStatic;
strictDeps = true;
hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie";
passthru = { passthru = {

View file

@ -69,12 +69,8 @@ mkMesonDerivation (finalAttrs: {
LDFLAGS = "-fuse-ld=gold"; LDFLAGS = "-fuse-ld=gold";
}; };
enableParallelBuilding = true;
separateDebugInfo = !stdenv.hostPlatform.isStatic; separateDebugInfo = !stdenv.hostPlatform.isStatic;
strictDeps = true;
hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie";
passthru = { passthru = {

View file

@ -66,12 +66,8 @@ mkMesonDerivation (finalAttrs: {
LDFLAGS = "-fuse-ld=gold"; LDFLAGS = "-fuse-ld=gold";
}; };
enableParallelBuilding = true;
separateDebugInfo = !stdenv.hostPlatform.isStatic; separateDebugInfo = !stdenv.hostPlatform.isStatic;
strictDeps = true;
hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie";
meta = { meta = {

View file

@ -73,12 +73,8 @@ mkMesonDerivation (finalAttrs: {
LDFLAGS = "-fuse-ld=gold"; LDFLAGS = "-fuse-ld=gold";
}; };
enableParallelBuilding = true;
separateDebugInfo = !stdenv.hostPlatform.isStatic; separateDebugInfo = !stdenv.hostPlatform.isStatic;
strictDeps = true;
hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie";
passthru = { passthru = {

View file

@ -64,12 +64,8 @@ mkMesonDerivation (finalAttrs: {
LDFLAGS = "-fuse-ld=gold"; LDFLAGS = "-fuse-ld=gold";
}; };
enableParallelBuilding = true;
separateDebugInfo = !stdenv.hostPlatform.isStatic; separateDebugInfo = !stdenv.hostPlatform.isStatic;
strictDeps = true;
hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie";
meta = { meta = {

View file

@ -70,12 +70,8 @@ mkMesonDerivation (finalAttrs: {
LDFLAGS = "-fuse-ld=gold"; LDFLAGS = "-fuse-ld=gold";
}; };
enableParallelBuilding = true;
separateDebugInfo = !stdenv.hostPlatform.isStatic; separateDebugInfo = !stdenv.hostPlatform.isStatic;
strictDeps = true;
hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie";
passthru = { passthru = {