diff --git a/package.nix b/package.nix index 11cee6a6c..caf245824 100644 --- a/package.nix +++ b/package.nix @@ -53,36 +53,6 @@ version = lib.fileContents ./.version + versionSuffix; - # .gitignore has already been processed, so any changes in it are irrelevant - # at this point. It is not represented verbatim for test purposes because - # that would interfere with repo semantics. - baseFiles = fileset.fileFilter (f: f.name != ".gitignore") ./.; - src = fileset.toSource { - root = ./.; - fileset = fileset.intersection baseFiles (fileset.unions [ - ./.version - ./boehmgc-coroutine-sp-fallback.diff - ./configure.ac - ./doc - ./local.mk - ./m4 - ./Makefile - ./Makefile.config.in - ./misc - ./mk - ./precompiled-headers.h - ./src - ./tests/functional - ./tests/unit - ./unit-test-data - ./COPYING - ./scripts/local.mk - (fileset.fileFilter (f: lib.strings.hasPrefix "nix-profile" f.name) ./scripts) - # TODO: do we really need README.md? It doesn't seem used in the build. - ./README.md - ]); - }; - aws-sdk-cpp-nix = aws-sdk-cpp.override { apis = [ "s3" "transfer" ]; customMemoryManagement = false; @@ -92,19 +62,65 @@ "RAPIDCHECK_HEADERS=${lib.getDev rapidcheck}/extras/gtest/include" ]; -in stdenv.mkDerivation (finalAttrs: { - name = "nix-${version}"; - inherit version; + # .gitignore has already been processed, so any changes in it are irrelevant + # at this point. It is not represented verbatim for test purposes because + # that would interfere with repo semantics. + baseFiles = fileset.fileFilter (f: f.name != ".gitignore") ./.; - inherit src; + configureFiles = fileset.unions [ + ./.version + ./configure.ac + ./m4 + # TODO: do we really need README.md? It doesn't seem used in the build. + ./README.md + ]; + + topLevelBuildFiles = fileset.unions [ + ./local.mk + ./Makefile + ./Makefile.config.in + ./mk + ]; + + functionalTestFiles = fileset.unions [ + ./tests/functional + ./tests/unit + (fileset.fileFilter (f: lib.strings.hasPrefix "nix-profile" f.name) ./scripts) + ]; + +in stdenv.mkDerivation (finalAttrs: { + inherit pname version; + + src = fileset.toSource { + root = ./.; + fileset = fileset.intersection baseFiles (fileset.unions ([ + configureFiles + topLevelBuildFiles + functionalTestFiles + ./unit-test-data + ] ++ lib.optionals finalAttrs.doBuild [ + ./boehmgc-coroutine-sp-fallback.diff + ./doc + ./misc + ./precompiled-headers.h + ./src + ./COPYING + ./scripts/local.mk + ])); + }; VERSION_SUFFIX = versionSuffix; - outputs = [ "out" "dev" "doc" ]; + outputs = [ "out" ] + ++ lib.optionals finalAttrs.doBuild [ "dev" "doc" ]; + + # dontBuild isn't specified most of the time, where it is implicitly false. + doBuild = !(finalAttrs.dontBuild or false); nativeBuildInputs = [ bison flex + ] ++ [ (lib.getBin lowdown) mdbook mdbook-linkcheck @@ -145,6 +161,9 @@ in stdenv.mkDerivation (finalAttrs: { rapidcheck ]; + # FIXME(Qyriad): remove at the end of refactoring. + checkInputs = finalAttrs.passthru._checkInputs; + propagatedBuildInputs = [ boehmgc nlohmann_json @@ -154,7 +173,7 @@ in stdenv.mkDerivation (finalAttrs: { boost ]; - preConfigure = lib.optionalString (! stdenv.hostPlatform.isStatic) '' + preConfigure = lib.optionalString (finalAttrs.doBuild && (! stdenv.hostPlatform.isStatic)) '' # Copy libboost_context so we don't get all of Boost in our closure. # https://github.com/NixOS/nixpkgs/issues/45462 mkdir -p $out/lib @@ -217,7 +236,7 @@ in stdenv.mkDerivation (finalAttrs: { export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES ''; - separateDebugInfo = !stdenv.hostPlatform.isStatic; + separateDebugInfo = !stdenv.hostPlatform.isStatic && finalAttrs.doBuild; strictDeps = true;