diff options
-rw-r--r-- | release-common.nix | 6 | ||||
-rw-r--r-- | release.nix | 102 | ||||
-rw-r--r-- | shell.nix | 2 |
3 files changed, 45 insertions, 65 deletions
diff --git a/release-common.nix b/release-common.nix index eb35d7917..b6c8f3d81 100644 --- a/release-common.nix +++ b/release-common.nix @@ -34,7 +34,7 @@ rec { "--with-sandbox-shell=${sh}/bin/busybox" ]; - tarballDeps = + buildDeps = [ bison flex libxml2 @@ -43,10 +43,8 @@ rec { docbook_xsl_ns autoconf-archive autoreconfHook - ]; - buildDeps = - [ curl + curl bzip2 xz brotli zlib editline openssl pkgconfig sqlite libarchive diff --git a/release.nix b/release.nix index b1cb1e437..be9f8b981 100644 --- a/release.nix +++ b/release.nix @@ -8,11 +8,14 @@ let pkgs = import nixpkgs { system = builtins.currentSystem or "x86_64-linux"; }; + version = + builtins.readFile ./.version + + (if officialRelease then "" else "pre${toString nix.revCount}_${nix.shortRev}"); + jobs = rec { # Create a "vendor" directory that contains the crates listed in - # Cargo.lock, and include it in the Nix tarball. This allows Nix - # to be built without network access. + # Cargo.lock. This allows Nix to be built without network access. vendoredCrates = let lockFile = builtins.fromTOML (builtins.readFile nix-rust/Cargo.lock); @@ -55,48 +58,6 @@ let ''; - tarball = - with pkgs; - - with import ./release-common.nix { inherit pkgs; }; - - releaseTools.sourceTarball { - name = "nix-tarball"; - version = builtins.readFile ./.version; - versionSuffix = if officialRelease then "" else "pre${toString nix.revCount}_${nix.shortRev}"; - src = nix; - inherit officialRelease; - - buildInputs = tarballDeps ++ buildDeps ++ propagatedDeps; - - postUnpack = '' - (cd $sourceRoot && find . -type f) | cut -c3- > $sourceRoot/.dist-files - cat $sourceRoot/.dist-files - ''; - - preConfigure = '' - (cd perl ; autoreconf --install --force --verbose) - # TeX needs a writable font cache. - export VARTEXFONTS=$TMPDIR/texfonts - ''; - - distPhase = - '' - cp -prd ${vendoredCrates}/vendor/ nix-rust/vendor/ - - runHook preDist - make dist - mkdir -p $out/tarballs - cp *.tar.* $out/tarballs - ''; - - preDist = '' - make install docdir=$out/share/doc/nix makefiles=doc/manual/local.mk - echo "doc manual $out/share/doc/nix/manual" >> $out/nix-support/hydra-build-products - ''; - }; - - build = pkgs.lib.genAttrs systems (system: let pkgs = import nixpkgs { inherit system; }; in @@ -105,20 +66,21 @@ let with import ./release-common.nix { inherit pkgs; }; - releaseTools.nixBuild { - name = "nix"; - src = tarball; + stdenv.mkDerivation { + name = "nix-${version}"; - outputs = [ "out" "dev" ]; + src = nix; + + outputs = [ "out" "dev" "doc" ]; buildInputs = buildDeps; propagatedBuildInputs = propagatedDeps; preConfigure = - # Copy libboost_context so we don't get all of Boost in our closure. - # https://github.com/NixOS/nixpkgs/issues/45462 '' + # 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 cp -pd ${boost}/lib/{libboost_context*,libboost_thread*,libboost_system*} $out/lib rm -f $out/lib/*.a @@ -126,6 +88,10 @@ let chmod u+w $out/lib/*.so.* patchelf --set-rpath $out/lib:${stdenv.cc.cc.lib}/lib $out/lib/libboost_thread.so.* ''} + + ln -sfn ${vendoredCrates}/vendor/ nix-rust/vendor + + (cd perl; autoreconf --install --force --verbose) ''; configureFlags = configureFlags ++ @@ -137,10 +103,17 @@ let installFlags = "sysconfdir=$(out)/etc"; + doCheck = true; + doInstallCheck = true; installCheckFlags = "sysconfdir=$(out)/etc"; separateDebugInfo = true; + + preDist = '' + mkdir -p $doc/nix-support + echo "doc manual $doc/share/doc/nix/manual" >> $doc/nix-support/hydra-build-products + ''; }); @@ -149,11 +122,21 @@ let let pkgs = import nixpkgs { inherit system; }; in with pkgs; releaseTools.nixBuild { - name = "nix-perl"; - src = tarball; + name = "nix-perl-${version}"; + + src = nix; buildInputs = - [ jobs.build.${system} curl bzip2 xz pkgconfig pkgs.perl boost ] + [ autoconf-archive + autoreconfHook + jobs.build.${system} + curl + bzip2 + xz + pkgconfig + pkgs.perl + boost + ] ++ lib.optional (stdenv.isLinux || stdenv.isDarwin) libsodium; configureFlags = '' @@ -173,7 +156,6 @@ let let toplevel = builtins.getAttr system jobs.build; - version = toplevel.src.version; installerClosureInfo = closureInfo { rootPaths = [ toplevel cacert ]; }; in @@ -243,8 +225,9 @@ let with import ./release-common.nix { inherit pkgs; }; releaseTools.coverageAnalysis { - name = "nix-build"; - src = tarball; + name = "nix-coverage-${version}"; + + src = nix; enableParallelBuilding = true; @@ -349,7 +332,7 @@ let (system: "--replace '@binaryTarball_${system}@' $(nix --experimental-features nix-command hash-file --base16 --type sha256 ${binaryTarball.${system}}/*.tar.xz) ") systems } \ - --replace '@nixVersion@' ${build.${builtins.head systems}.src.version} + --replace '@nixVersion@' ${version} echo "file installer $out/install" >> $out/nix-support/hydra-build-products ''; @@ -357,11 +340,10 @@ let # Aggregate job containing the release-critical jobs. release = pkgs.releaseTools.aggregate { - name = "nix-${tarball.version}"; + name = "nix-${version}"; meta.description = "Release-critical builds"; constituents = - [ tarball - build.i686-linux + [ build.i686-linux build.x86_64-darwin build.x86_64-linux build.aarch64-linux @@ -7,7 +7,7 @@ with import ./release-common.nix { inherit pkgs; }; (if useClang then clangStdenv else stdenv).mkDerivation { name = "nix"; - buildInputs = buildDeps ++ propagatedDeps ++ tarballDeps ++ perlDeps ++ [ pkgs.rustfmt ]; + buildInputs = buildDeps ++ propagatedDeps ++ perlDeps ++ [ pkgs.rustfmt ]; inherit configureFlags; |