diff --git a/src/libexpr-c/package.nix b/src/libexpr-c/package.nix index 33412e218..81e42cf6a 100644 --- a/src/libexpr-c/package.nix +++ b/src/libexpr-c/package.nix @@ -1,5 +1,6 @@ { lib , stdenv +, mkMesonDerivation , releaseTools , meson @@ -12,41 +13,30 @@ # 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: { +mkMesonDerivation (finalAttrs: { pname = "nix-expr-c"; 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") ./.) - (fileset.fileFilter (file: file.hasExt "h") ./.) - ]; - }; + workDir = ./.; + fileset = fileset.unions [ + ../../build-utils-meson + ./build-utils-meson + ../../.version + ./.version + ./meson.build + # ./meson.options + (fileset.fileFilter (file: file.hasExt "cc") ./.) + (fileset.fileFilter (file: file.hasExt "hh") ./.) + (fileset.fileFilter (file: file.hasExt "h") ./.) + ]; outputs = [ "out" "dev" ]; @@ -65,8 +55,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 = [ @@ -80,8 +70,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"; @@ -89,8 +78,4 @@ mkDerivation (finalAttrs: { platforms = lib.platforms.unix ++ lib.platforms.windows; }; -} // lib.optionalAttrs withCoverageChecks { - lcovFilter = [ "*/boost/*" "*-tab.*" ]; - - hardeningDisable = [ "fortify" ]; }) diff --git a/src/libexpr/package.nix b/src/libexpr/package.nix index 855d5057e..d4296bc07 100644 --- a/src/libexpr/package.nix +++ b/src/libexpr/package.nix @@ -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" ]; }) diff --git a/src/libfetchers/package.nix b/src/libfetchers/package.nix index 681ffa112..7786a4f35 100644 --- a/src/libfetchers/package.nix +++ b/src/libfetchers/package.nix @@ -1,5 +1,6 @@ { lib , stdenv +, mkMesonDerivation , releaseTools , meson @@ -15,40 +16,28 @@ # Configuration Options , versionSuffix ? "" - -# Check test coverage of Nix. Probably want to use with 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: { +mkMesonDerivation (finalAttrs: { pname = "nix-fetchers"; inherit version; - src = fileset.toSource { - root = ./.; - fileset = fileset.unions [ - ./meson.build - (fileset.fileFilter (file: file.hasExt "cc") ./.) - (fileset.fileFilter (file: file.hasExt "hh") ./.) - ]; - }; + workDir = ./.; + fileset = fileset.unions [ + ../../build-utils-meson + ./build-utils-meson + ../../.version + ./.version + ./meson.build + (fileset.fileFilter (file: file.hasExt "cc") ./.) + (fileset.fileFilter (file: file.hasExt "hh") ./.) + ]; outputs = [ "out" "dev" ]; @@ -72,8 +61,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 ''; env = lib.optionalAttrs (stdenv.isLinux && !(stdenv.hostPlatform.isStatic && stdenv.system == "aarch64-linux")) { @@ -86,7 +75,7 @@ mkDerivation (finalAttrs: { # TODO `releaseTools.coverageAnalysis` in Nixpkgs needs to be updated # to work with `strictDeps`. - strictDeps = !withCoverageChecks; + strictDeps = true; hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; @@ -94,8 +83,4 @@ mkDerivation (finalAttrs: { platforms = lib.platforms.unix ++ lib.platforms.windows; }; -} // lib.optionalAttrs withCoverageChecks { - lcovFilter = [ "*-tab.*" ]; - - hardeningDisable = ["fortify"]; }) diff --git a/src/libflake/package.nix b/src/libflake/package.nix index 523da4b78..f0609d5d5 100644 --- a/src/libflake/package.nix +++ b/src/libflake/package.nix @@ -1,5 +1,6 @@ { lib , stdenv +, mkMesonDerivation , releaseTools , meson @@ -17,40 +18,28 @@ # Configuration Options , versionSuffix ? "" - -# Check test coverage of Nix. Probably want to use with 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: { +mkMesonDerivation (finalAttrs: { pname = "nix-flake"; inherit version; - src = fileset.toSource { - root = ./.; - fileset = fileset.unions [ - ./meson.build - (fileset.fileFilter (file: file.hasExt "cc") ./.) - (fileset.fileFilter (file: file.hasExt "hh") ./.) - ]; - }; + workDir = ./.; + fileset = fileset.unions [ + ../../build-utils-meson + ./build-utils-meson + ../../.version + ./.version + ./meson.build + (fileset.fileFilter (file: file.hasExt "cc") ./.) + (fileset.fileFilter (file: file.hasExt "hh") ./.) + ]; outputs = [ "out" "dev" ]; @@ -72,8 +61,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 ''; env = lib.optionalAttrs (stdenv.isLinux && !(stdenv.hostPlatform.isStatic && stdenv.system == "aarch64-linux")) { @@ -86,7 +75,7 @@ mkDerivation (finalAttrs: { # TODO `releaseTools.coverageAnalysis` in Nixpkgs needs to be updated # to work with `strictDeps`. - strictDeps = !withCoverageChecks; + strictDeps = true; hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; @@ -94,8 +83,4 @@ mkDerivation (finalAttrs: { platforms = lib.platforms.unix ++ lib.platforms.windows; }; -} // lib.optionalAttrs withCoverageChecks { - lcovFilter = [ "*-tab.*" ]; - - hardeningDisable = ["fortify"]; }) diff --git a/src/libstore-c/package.nix b/src/libstore-c/package.nix index d0e81b1f9..c14cf955d 100644 --- a/src/libstore-c/package.nix +++ b/src/libstore-c/package.nix @@ -1,5 +1,6 @@ { lib , stdenv +, mkMesonDerivation , releaseTools , meson @@ -12,41 +13,30 @@ # 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: { +mkMesonDerivation (finalAttrs: { pname = "nix-store-c"; 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") ./.) - (fileset.fileFilter (file: file.hasExt "h") ./.) - ]; - }; + workDir = ./.; + fileset = fileset.unions [ + ../../build-utils-meson + ./build-utils-meson + ../../.version + ./.version + ./meson.build + # ./meson.options + (fileset.fileFilter (file: file.hasExt "cc") ./.) + (fileset.fileFilter (file: file.hasExt "hh") ./.) + (fileset.fileFilter (file: file.hasExt "h") ./.) + ]; outputs = [ "out" "dev" ]; @@ -65,8 +55,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 = [ @@ -80,8 +70,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"; @@ -89,8 +78,4 @@ mkDerivation (finalAttrs: { platforms = lib.platforms.unix ++ lib.platforms.windows; }; -} // lib.optionalAttrs withCoverageChecks { - lcovFilter = [ "*/boost/*" "*-tab.*" ]; - - hardeningDisable = [ "fortify" ]; }) diff --git a/src/libstore/package.nix b/src/libstore/package.nix index d4859a411..df92b5b28 100644 --- a/src/libstore/package.nix +++ b/src/libstore/package.nix @@ -1,5 +1,6 @@ { lib , stdenv +, mkMesonDerivation , releaseTools , meson @@ -22,46 +23,35 @@ , versionSuffix ? "" , embeddedSandboxShell ? stdenv.hostPlatform.isStatic - -# 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: { +mkMesonDerivation (finalAttrs: { pname = "nix-store"; inherit version; - src = fileset.toSource { - root = ./.; - fileset = fileset.unions [ - ./meson.build - ./meson.options - ./linux/meson.build - ./unix/meson.build - ./windows/meson.build - (fileset.fileFilter (file: file.hasExt "cc") ./.) - (fileset.fileFilter (file: file.hasExt "hh") ./.) - (fileset.fileFilter (file: file.hasExt "sb") ./.) - (fileset.fileFilter (file: file.hasExt "md") ./.) - (fileset.fileFilter (file: file.hasExt "sql") ./.) - ]; - }; + workDir = ./.; + fileset = fileset.unions [ + ../../build-utils-meson + ./build-utils-meson + ../../.version + ./.version + ./meson.build + ./meson.options + ./linux/meson.build + ./unix/meson.build + ./windows/meson.build + (fileset.fileFilter (file: file.hasExt "cc") ./.) + (fileset.fileFilter (file: file.hasExt "hh") ./.) + (fileset.fileFilter (file: file.hasExt "sb") ./.) + (fileset.fileFilter (file: file.hasExt "md") ./.) + (fileset.fileFilter (file: file.hasExt "sql") ./.) + ]; outputs = [ "out" "dev" ]; @@ -93,8 +83,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 = [ @@ -117,8 +107,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"; @@ -126,8 +115,4 @@ mkDerivation (finalAttrs: { platforms = lib.platforms.unix ++ lib.platforms.windows; }; -} // lib.optionalAttrs withCoverageChecks { - lcovFilter = [ "*/boost/*" "*-tab.*" ]; - - hardeningDisable = [ "fortify" ]; }) diff --git a/src/libutil-c/package.nix b/src/libutil-c/package.nix index ba1dbe38a..f92cb036c 100644 --- a/src/libutil-c/package.nix +++ b/src/libutil-c/package.nix @@ -1,5 +1,6 @@ { lib , stdenv +, mkMesonDerivation , releaseTools , meson @@ -11,41 +12,30 @@ # 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: { +mkMesonDerivation (finalAttrs: { pname = "nix-util-c"; 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") ./.) - (fileset.fileFilter (file: file.hasExt "h") ./.) - ]; - }; + workDir = ./.; + fileset = fileset.unions [ + ../../build-utils-meson + ./build-utils-meson + ../../.version + ./.version + ./meson.build + ./meson.options + (fileset.fileFilter (file: file.hasExt "cc") ./.) + (fileset.fileFilter (file: file.hasExt "hh") ./.) + (fileset.fileFilter (file: file.hasExt "h") ./.) + ]; outputs = [ "out" "dev" ]; @@ -63,8 +53,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 = [ @@ -78,8 +68,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"; @@ -87,8 +76,4 @@ mkDerivation (finalAttrs: { platforms = lib.platforms.unix ++ lib.platforms.windows; }; -} // lib.optionalAttrs withCoverageChecks { - lcovFilter = [ "*/boost/*" "*-tab.*" ]; - - hardeningDisable = [ "fortify" ]; }) diff --git a/src/libutil/package.nix b/src/libutil/package.nix index aff338d16..74d4d7853 100644 --- a/src/libutil/package.nix +++ b/src/libutil/package.nix @@ -18,25 +18,12 @@ # 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 mkMesonDerivation (finalAttrs: { @@ -45,6 +32,8 @@ mkMesonDerivation (finalAttrs: { workDir = ./.; fileset = fileset.unions [ + ../../build-utils-meson + ./build-utils-meson ../../.version ./.version ./meson.build @@ -78,12 +67,14 @@ mkMesonDerivation (finalAttrs: { ]; preConfigure = - # TODO: change release process to add `pre` in `.version`, remove it before tagging, and restore after. + # "Inline" .version so it's not a symlink, and includes the suffix. # Do the meson utils, without modification. + # + # TODO: change release process to add `pre` in `.version`, remove it + # before tagging, and restore after. '' chmod u+w ./.version echo ${version} > ../../.version - cp -r ${../../build-utils-meson} build-utils-meson ''; mesonFlags = [ @@ -103,8 +94,7 @@ mkMesonDerivation (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"; @@ -112,8 +102,4 @@ mkMesonDerivation (finalAttrs: { platforms = lib.platforms.unix ++ lib.platforms.windows; }; -} // lib.optionalAttrs withCoverageChecks { - lcovFilter = [ "*/boost/*" "*-tab.*" ]; - - hardeningDisable = [ "fortify" ]; }) diff --git a/src/nix-expr-test-support/package.nix b/src/nix-expr-test-support/package.nix index ecfb2bb09..aec0e7663 100644 --- a/src/nix-expr-test-support/package.nix +++ b/src/nix-expr-test-support/package.nix @@ -1,5 +1,6 @@ { lib , stdenv +, mkMesonDerivation , releaseTools , meson @@ -14,40 +15,29 @@ # 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: { +mkMesonDerivation (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") ./.) - ]; - }; + workDir = ./.; + fileset = fileset.unions [ + ../../build-utils-meson + ./build-utils-meson + ../../.version + ./.version + ./meson.build + # ./meson.options + (fileset.fileFilter (file: file.hasExt "cc") ./.) + (fileset.fileFilter (file: file.hasExt "hh") ./.) + ]; outputs = [ "out" "dev" ]; @@ -67,8 +57,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 = [ @@ -82,8 +72,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"; @@ -91,8 +80,4 @@ mkDerivation (finalAttrs: { platforms = lib.platforms.unix ++ lib.platforms.windows; }; -} // lib.optionalAttrs withCoverageChecks { - lcovFilter = [ "*/boost/*" "*-tab.*" ]; - - hardeningDisable = [ "fortify" ]; }) diff --git a/src/nix-expr-tests/package.nix b/src/nix-expr-tests/package.nix index 679b6fb2a..ddd79fd55 100644 --- a/src/nix-expr-tests/package.nix +++ b/src/nix-expr-tests/package.nix @@ -1,5 +1,6 @@ { lib , stdenv +, mkMesonDerivation , releaseTools , meson @@ -17,40 +18,29 @@ # 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: { +mkMesonDerivation (finalAttrs: { pname = "nix-expr-tests"; 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") ./.) - ]; - }; + workDir = ./.; + fileset = fileset.unions [ + ../../build-utils-meson + ./build-utils-meson + ../../.version + ./.version + ./meson.build + # ./meson.options + (fileset.fileFilter (file: file.hasExt "cc") ./.) + (fileset.fileFilter (file: file.hasExt "hh") ./.) + ]; outputs = [ "out" "dev" ]; @@ -72,8 +62,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 = [ @@ -87,8 +77,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"; @@ -108,8 +97,4 @@ mkDerivation (finalAttrs: { platforms = lib.platforms.unix ++ lib.platforms.windows; }; -} // lib.optionalAttrs withCoverageChecks { - lcovFilter = [ "*/boost/*" "*-tab.*" ]; - - hardeningDisable = [ "fortify" ]; }) diff --git a/src/nix-fetchers-tests/package.nix b/src/nix-fetchers-tests/package.nix index 5cf18ce33..759743a8b 100644 --- a/src/nix-fetchers-tests/package.nix +++ b/src/nix-fetchers-tests/package.nix @@ -1,5 +1,6 @@ { lib , stdenv +, mkMesonDerivation , releaseTools , meson @@ -16,40 +17,29 @@ # 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: { +mkMesonDerivation (finalAttrs: { pname = "nix-fetchers-tests"; 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") ./.) - ]; - }; + workDir = ./.; + fileset = fileset.unions [ + ../../build-utils-meson + ./build-utils-meson + ../../.version + ./.version + ./meson.build + # ./meson.options + (fileset.fileFilter (file: file.hasExt "cc") ./.) + (fileset.fileFilter (file: file.hasExt "hh") ./.) + ]; outputs = [ "out" "dev" ]; @@ -70,8 +60,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 = [ @@ -85,8 +75,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"; @@ -106,8 +95,4 @@ mkDerivation (finalAttrs: { platforms = lib.platforms.unix ++ lib.platforms.windows; }; -} // lib.optionalAttrs withCoverageChecks { - lcovFilter = [ "*/boost/*" "*-tab.*" ]; - - hardeningDisable = [ "fortify" ]; }) diff --git a/src/nix-flake-tests/package.nix b/src/nix-flake-tests/package.nix index 21af753ae..a7783593a 100644 --- a/src/nix-flake-tests/package.nix +++ b/src/nix-flake-tests/package.nix @@ -1,5 +1,6 @@ { lib , stdenv +, mkMesonDerivation , releaseTools , meson @@ -16,40 +17,29 @@ # 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: { +mkMesonDerivation (finalAttrs: { pname = "nix-flake-tests"; 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") ./.) - ]; - }; + workDir = ./.; + fileset = fileset.unions [ + ../../build-utils-meson + ./build-utils-meson + ../../.version + ./.version + ./meson.build + # ./meson.options + (fileset.fileFilter (file: file.hasExt "cc") ./.) + (fileset.fileFilter (file: file.hasExt "hh") ./.) + ]; outputs = [ "out" "dev" ]; @@ -70,8 +60,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 = [ @@ -85,8 +75,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"; @@ -106,8 +95,4 @@ mkDerivation (finalAttrs: { platforms = lib.platforms.unix ++ lib.platforms.windows; }; -} // lib.optionalAttrs withCoverageChecks { - lcovFilter = [ "*/boost/*" "*-tab.*" ]; - - hardeningDisable = [ "fortify" ]; }) diff --git a/src/nix-store-test-support/package.nix b/src/nix-store-test-support/package.nix index 0f4ea73ba..250f29b86 100644 --- a/src/nix-store-test-support/package.nix +++ b/src/nix-store-test-support/package.nix @@ -1,5 +1,6 @@ { lib , stdenv +, mkMesonDerivation , releaseTools , meson @@ -14,40 +15,29 @@ # 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: { +mkMesonDerivation (finalAttrs: { pname = "nix-store-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") ./.) - ]; - }; + workDir = ./.; + fileset = fileset.unions [ + ../../build-utils-meson + ./build-utils-meson + ../../.version + ./.version + ./meson.build + # ./meson.options + (fileset.fileFilter (file: file.hasExt "cc") ./.) + (fileset.fileFilter (file: file.hasExt "hh") ./.) + ]; outputs = [ "out" "dev" ]; @@ -67,8 +57,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 = [ @@ -82,8 +72,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"; @@ -91,8 +80,4 @@ mkDerivation (finalAttrs: { platforms = lib.platforms.unix ++ lib.platforms.windows; }; -} // lib.optionalAttrs withCoverageChecks { - lcovFilter = [ "*/boost/*" "*-tab.*" ]; - - hardeningDisable = [ "fortify" ]; }) diff --git a/src/nix-store-tests/package.nix b/src/nix-store-tests/package.nix index dc987b3c6..e6750771f 100644 --- a/src/nix-store-tests/package.nix +++ b/src/nix-store-tests/package.nix @@ -1,5 +1,6 @@ { lib , stdenv +, mkMesonDerivation , releaseTools , meson @@ -18,40 +19,29 @@ # 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: { +mkMesonDerivation (finalAttrs: { pname = "nix-store-tests"; 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") ./.) - ]; - }; + workDir = ./.; + fileset = fileset.unions [ + ../../build-utils-meson + ./build-utils-meson + ../../.version + ./.version + ./meson.build + # ./meson.options + (fileset.fileFilter (file: file.hasExt "cc") ./.) + (fileset.fileFilter (file: file.hasExt "hh") ./.) + ]; outputs = [ "out" "dev" ]; @@ -74,8 +64,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 = [ @@ -89,8 +79,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"; @@ -115,8 +104,4 @@ mkDerivation (finalAttrs: { platforms = lib.platforms.unix ++ lib.platforms.windows; }; -} // lib.optionalAttrs withCoverageChecks { - lcovFilter = [ "*/boost/*" "*-tab.*" ]; - - hardeningDisable = [ "fortify" ]; }) diff --git a/src/nix-util-test-support/package.nix b/src/nix-util-test-support/package.nix index 795159ebf..42a56d58f 100644 --- a/src/nix-util-test-support/package.nix +++ b/src/nix-util-test-support/package.nix @@ -1,5 +1,6 @@ { lib , stdenv +, mkMesonDerivation , releaseTools , meson @@ -13,40 +14,29 @@ # 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: { +mkMesonDerivation (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") ./.) - ]; - }; + workDir = ./.; + fileset = fileset.unions [ + ../../build-utils-meson + ./build-utils-meson + ../../.version + ./.version + ./meson.build + # ./meson.options + (fileset.fileFilter (file: file.hasExt "cc") ./.) + (fileset.fileFilter (file: file.hasExt "hh") ./.) + ]; outputs = [ "out" "dev" ]; @@ -65,8 +55,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 = [ @@ -80,8 +70,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"; @@ -89,8 +78,4 @@ mkDerivation (finalAttrs: { platforms = lib.platforms.unix ++ lib.platforms.windows; }; -} // lib.optionalAttrs withCoverageChecks { - lcovFilter = [ "*/boost/*" "*-tab.*" ]; - - hardeningDisable = [ "fortify" ]; }) diff --git a/src/nix-util-tests/package.nix b/src/nix-util-tests/package.nix index 9df8153b6..2491d8722 100644 --- a/src/nix-util-tests/package.nix +++ b/src/nix-util-tests/package.nix @@ -1,5 +1,6 @@ { lib , stdenv +, mkMesonDerivation , releaseTools , meson @@ -17,40 +18,29 @@ # 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: { +mkMesonDerivation (finalAttrs: { pname = "nix-util-tests"; 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") ./.) - ]; - }; + workDir = ./.; + fileset = fileset.unions [ + ../../build-utils-meson + ./build-utils-meson + ../../.version + ./.version + ./meson.build + # ./meson.options + (fileset.fileFilter (file: file.hasExt "cc") ./.) + (fileset.fileFilter (file: file.hasExt "hh") ./.) + ]; outputs = [ "out" "dev" ]; @@ -72,8 +62,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 = [ @@ -87,8 +77,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"; @@ -108,8 +97,4 @@ mkDerivation (finalAttrs: { platforms = lib.platforms.unix ++ lib.platforms.windows; }; -} // lib.optionalAttrs withCoverageChecks { - lcovFilter = [ "*/boost/*" "*-tab.*" ]; - - hardeningDisable = [ "fortify" ]; })