From 7c39201bcb181653af2bafee2fc02d1bcc58691b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 13 Mar 2020 14:05:49 +0100 Subject: [PATCH] Remove the tarball job Source tarballs are not very useful anymore. People who want to build from source can also just build from the Git repository. Once upon a time, the source tarball also saved users from needing a few dependencies (e.g. bison and flex) but those are dwarfed by the other dependencies, so it's no longer worth it. Note: the release script should be updated to copy the vendoredCrates tarball. --- release-common.nix | 6 +-- release.nix | 102 +++++++++++++++++++-------------------------- 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 diff --git a/shell.nix b/shell.nix index 0cabcc15a..e3b422c7c 100644 --- a/shell.nix +++ b/shell.nix @@ -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;