Merge remote-tracking branch 'origin/master' into flakes

This commit is contained in:
Eelco Dolstra 2020-03-13 18:28:01 +01:00
commit 3e1abf4f05

111
flake.nix
View file

@ -9,6 +9,12 @@
let let
version =
builtins.readFile ./.version
+ (if officialRelease
then ""
else "pre${builtins.substring 0 8 self.lastModified}_${self.shortRev or "dirty"}");
officialRelease = false; officialRelease = false;
systems = [ "x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-linux" ]; systems = [ "x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-linux" ];
@ -55,7 +61,7 @@
"--with-sandbox-shell=${sh}/bin/busybox" "--with-sandbox-shell=${sh}/bin/busybox"
]; ];
tarballDeps = buildDeps =
[ bison [ bison
flex flex
libxml2 libxml2
@ -64,10 +70,8 @@
docbook_xsl_ns docbook_xsl_ns
autoconf-archive autoconf-archive
autoreconfHook autoreconfHook
];
buildDeps = curl
[ curl
bzip2 xz brotli zlib editline bzip2 xz brotli zlib editline
openssl pkgconfig sqlite openssl pkgconfig sqlite
libarchive libarchive
@ -104,20 +108,21 @@
# 'nix.perl-bindings' packages. # 'nix.perl-bindings' packages.
overlay = final: prev: { overlay = final: prev: {
nix = with final; with commonDeps pkgs; (releaseTools.nixBuild { nix = with final; with commonDeps pkgs; (stdenv.mkDerivation {
name = "nix"; name = "nix-${version}";
src = self.hydraJobs.tarball;
outputs = [ "out" "dev" ]; src = self;
outputs = [ "out" "dev" "doc" ];
buildInputs = buildDeps; buildInputs = buildDeps;
propagatedBuildInputs = propagatedDeps; propagatedBuildInputs = propagatedDeps;
preConfigure = 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 mkdir -p $out/lib
cp -pd ${boost}/lib/{libboost_context*,libboost_thread*,libboost_system*} $out/lib cp -pd ${boost}/lib/{libboost_context*,libboost_thread*,libboost_system*} $out/lib
rm -f $out/lib/*.a rm -f $out/lib/*.a
@ -125,6 +130,10 @@
chmod u+w $out/lib/*.so.* chmod u+w $out/lib/*.so.*
patchelf --set-rpath $out/lib:${stdenv.cc.cc.lib}/lib $out/lib/libboost_thread.so.* patchelf --set-rpath $out/lib:${stdenv.cc.cc.lib}/lib $out/lib/libboost_thread.so.*
''} ''}
ln -sfn ${self.hydraJobs.vendoredCrates}/vendor/ nix-rust/vendor
(cd perl; autoreconf --install --force --verbose)
''; '';
configureFlags = configureFlags ++ configureFlags = configureFlags ++
@ -134,20 +143,37 @@
makeFlags = "profiledir=$(out)/etc/profile.d"; makeFlags = "profiledir=$(out)/etc/profile.d";
doCheck = true;
installFlags = "sysconfdir=$(out)/etc"; installFlags = "sysconfdir=$(out)/etc";
doInstallCheck = true; doInstallCheck = true;
installCheckFlags = "sysconfdir=$(out)/etc"; installCheckFlags = "sysconfdir=$(out)/etc";
separateDebugInfo = true; separateDebugInfo = true;
preDist = ''
mkdir -p $doc/nix-support
echo "doc manual $doc/share/doc/nix/manual" >> $doc/nix-support/hydra-build-products
'';
}) // { }) // {
perl-bindings = with final; releaseTools.nixBuild { perl-bindings = with final; stdenv.mkDerivation {
name = "nix-perl"; name = "nix-perl-${version}";
src = self.hydraJobs.tarball;
src = self;
buildInputs = buildInputs =
[ nix curl bzip2 xz pkgconfig pkgs.perl boost ] [ autoconf-archive
autoreconfHook
nix
curl
bzip2
xz
pkgconfig
pkgs.perl
boost
]
++ lib.optional (stdenv.isLinux || stdenv.isDarwin) libsodium; ++ lib.optional (stdenv.isLinux || stdenv.isDarwin) libsodium;
configureFlags = '' configureFlags = ''
@ -212,48 +238,6 @@
'') files)} '') files)}
''; '';
# Source tarball.
tarball =
with nixpkgsFor.x86_64-linux;
with commonDeps pkgs;
releaseTools.sourceTarball {
name = "nix-tarball";
version = builtins.readFile ./.version;
versionSuffix = if officialRelease then "" else
"pre${builtins.substring 0 8 self.lastModified}_${self.shortRev or "dirty"}";
src = self;
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 ${self.hydraJobs.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
'';
};
# Binary package for various platforms. # Binary package for various platforms.
build = nixpkgs.lib.genAttrs systems (system: nixpkgsFor.${system}.nix); build = nixpkgs.lib.genAttrs systems (system: nixpkgsFor.${system}.nix);
@ -268,7 +252,6 @@
with nixpkgsFor.${system}; with nixpkgsFor.${system};
let let
version = nix.src.version;
installerClosureInfo = closureInfo { rootPaths = [ nix cacert ]; }; installerClosureInfo = closureInfo { rootPaths = [ nix cacert ]; };
in in
@ -348,7 +331,7 @@
(system: "--replace '@binaryTarball_${system}@' $(nix --experimental-features nix-command hash-file --base16 --type sha256 ${self.hydraJobs.binaryTarball.${system}}/*.tar.xz) ") (system: "--replace '@binaryTarball_${system}@' $(nix --experimental-features nix-command hash-file --base16 --type sha256 ${self.hydraJobs.binaryTarball.${system}}/*.tar.xz) ")
[ "x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-linux" ] [ "x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-linux" ]
} \ } \
--replace '@nixVersion@' ${nix.src.version} --replace '@nixVersion@' ${version}
echo "file installer $out/install" >> $out/nix-support/hydra-build-products echo "file installer $out/install" >> $out/nix-support/hydra-build-products
''; '';
@ -359,8 +342,9 @@
with commonDeps pkgs; with commonDeps pkgs;
releaseTools.coverageAnalysis { releaseTools.coverageAnalysis {
name = "nix-build"; name = "nix-coverage-${version}";
src = self.hydraJobs.tarball;
src = self;
enableParallelBuilding = true; enableParallelBuilding = true;
@ -468,11 +452,10 @@
release = release =
with self.hydraJobs; with self.hydraJobs;
nixpkgsFor.x86_64-linux.releaseTools.aggregate { nixpkgsFor.x86_64-linux.releaseTools.aggregate {
name = "nix-${tarball.version}"; name = "nix-${version}";
meta.description = "Release-critical builds"; meta.description = "Release-critical builds";
constituents = constituents =
[ "tarball" [ "build.i686-linux"
"build.i686-linux"
"build.x86_64-darwin" "build.x86_64-darwin"
"build.x86_64-linux" "build.x86_64-linux"
"build.aarch64-linux" "build.aarch64-linux"
@ -509,7 +492,7 @@
stdenv.mkDerivation { stdenv.mkDerivation {
name = "nix"; name = "nix";
buildInputs = buildDeps ++ propagatedDeps ++ tarballDeps ++ perlDeps ++ [ pkgs.rustfmt ]; buildInputs = buildDeps ++ propagatedDeps ++ perlDeps ++ [ pkgs.rustfmt ];
inherit configureFlags; inherit configureFlags;