Simplify running nix-shell

This also removes building a separate source tarball or building a PDF
manual since it's unlikely anybody cares.
This commit is contained in:
Eelco Dolstra 2016-03-22 12:53:28 +01:00
parent ac23bd1539
commit 74426e6820
7 changed files with 30 additions and 89 deletions

View file

@ -1,6 +1,6 @@
To start hacking on Hydra, run:
$ ./dev-shell
$ nix-shell
$ ./configure $configureFlags --prefix=/opt/hydra
$ make
$ make install

View file

@ -12,9 +12,6 @@ AC_PROG_CXX
CXXFLAGS+=" -std=c++11"
dnl Optional dependencies to build the manual, normally not needed
dnl since the tarball comes with the PDF and HTML manuals.
AC_PATH_PROG([DBLATEX], [dblatex])
AC_PATH_PROG([XSLTPROC], [xsltproc])
AC_ARG_WITH([docbook-xsl],

View file

@ -1,7 +0,0 @@
#! /usr/bin/env bash
s=$(type -p nix-shell)
exec $s release.nix -A build.x86_64-linux --exclude tarball --command "
export NIX_REMOTE=daemon
export NIX_PATH='$NIX_PATH'
export NIX_BUILD_SHELL=$(type -p bash)
exec $s release.nix -A tarball" "$@"

View file

@ -9,44 +9,21 @@ xsltproc_opts = \
--param section.label.includes.component.label 1
dblatex_opts = \
-V \
-P doc.collab.show=0 \
-P latex.output.revhistory=0
# Include the manual in the tarball.
dist_html_DATA = manual.html style.css
#dist_pdf_DATA = manual.pdf
# Embed Docbook's callout images in the distribution.
EXTRA_DIST += images
manual.html: $(DOCBOOK_FILES)
if test "$(XSLTPROC)" != ""; then \
$(XSLTPROC) $(xsltproc_opts) --nonet --xinclude \
--output manual.html \
$(docbookxsl)/html/docbook.xsl manual.xml; \
else \
echo "Please install xsltproc and rerun configure."; \
exit 1; \
fi
manual.pdf: $(DOCBOOK_FILES)
if test "$(DBLATEX)" != ""; then \
$(DBLATEX) $(dblatex_opts) manual.xml; \
else \
echo "Please install dblatex and rerun configure."; \
exit 1; \
fi
$(docbookxsl)/xhtml/docbook.xsl manual.xml
images:
$(MKDIR_P) images/callouts
if cp $(docbookxsl)/images/callouts/*.gif images/callouts; then \
chmod +wx images images/callouts; \
else \
echo "Please install Docbook XSL and try again."; \
exit 1; \
fi
cp $(docbookxsl)/images/callouts/*.gif images/callouts
chmod +wx images images/callouts
install-data-hook: images
$(INSTALL) -d $(DESTDIR)$(htmldir)/images/callouts

View file

@ -22,7 +22,7 @@ $ nix-build release.nix -A build.x86_64-linux
environment variables (such as <envar>PERL5LIB</envar>) are set up so
that those dependencies can be found:
<screen>
$ ./dev-shell
$ nix-shell
</screen>
To build Hydra, you should then do:
<screen>

View file

@ -1,4 +1,4 @@
{ hydraSrc ? { outPath = ./.; revCount = 1234; gitTag = "abcdef"; }
{ hydraSrc ? { outPath = ./.; revCount = 1234; rev = "abcdef"; }
, officialRelease ? false
}:
@ -28,55 +28,14 @@ let
environment.systemPackages = [ pkgs.perlPackages.LWP pkgs.perlPackages.JSON ];
};
version = builtins.readFile ./version + "." + toString hydraSrc.revCount + "." + hydraSrc.rev;
in
assert versionAtLeast (getVersion pkgs.nixUnstable) "1.11pre4244_133a421";
rec {
tarball =
with pkgs;
releaseTools.makeSourceTarball {
name = "hydra-tarball";
src = if lib.inNixShell then null else hydraSrc;
inherit officialRelease;
version = builtins.readFile ./version;
buildInputs =
[ perl libxslt nukeReferences pkgconfig nixUnstable git openssl ];
versionSuffix = if officialRelease then "" else "pre${toString hydraSrc.revCount}-${hydraSrc.gitTag}";
preHook = ''
# TeX needs a writable font cache.
export VARTEXFONTS=$TMPDIR/texfonts
addToSearchPath PATH $(pwd)/src/script
addToSearchPath PATH $(pwd)/src/hydra-eval-jobs
addToSearchPath PATH $(pwd)/src/hydra-queue-runner
addToSearchPath PERL5LIB $(pwd)/src/lib
'';
postUnpack = ''
# Clean up when building from a working tree.
if [ -z "$IN_NIX_SHELL" ]; then
(cd $sourceRoot && (git ls-files -o --directory | xargs -r rm -rfv)) || true
fi
'';
configureFlags =
[ "--with-docbook-xsl=${docbook_xsl}/xml/xsl/docbook" ];
postDist = ''
make -C doc/manual install prefix="$out"
echo "doc manual $out/share/doc/hydra manual.html" >> \
"$out/nix-support/hydra-build-products"
'';
};
build = genAttrs' (system:
with import <nixpkgs> { inherit system; };
@ -143,7 +102,7 @@ rec {
TextDiff
TextTable
XMLSimple
nix git
nix git boehmgc
];
};
@ -151,11 +110,12 @@ rec {
releaseTools.nixBuild {
name = "hydra";
src = tarball;
src = if lib.inNixShell then null else hydraSrc;
buildInputs =
[ makeWrapper libtool unzip nukeReferences pkgconfig sqlite libpqxx
gitAndTools.topGit mercurial darcs subversion bazaar openssl bzip2
[ makeWrapper autoconf automake libtool unzip nukeReferences pkgconfig sqlite libpqxx
gitAndTools.topGit mercurial darcs subversion bazaar openssl bzip2 libxslt
guile # optional, for Guile + Guix support
perlDeps perl
postgresql92 # for running the tests
@ -170,6 +130,19 @@ rec {
gzip bzip2 lzma gnutar unzip git gitAndTools.topGit mercurial darcs gnused bazaar
] ++ lib.optionals stdenv.isLinux [ rpm dpkg cdrkit ] );
postUnpack = ''
# Clean up when building from a working tree.
if [ -z "$IN_NIX_SHELL" ]; then
(cd $sourceRoot && (git ls-files -o --directory | xargs -r rm -rfv)) || true
fi
'';
configureFlags = [ "--with-docbook-xsl=${docbook_xsl}/xml/xsl/docbook" ];
preConfigure = "autoreconf -vfi";
enableParallelBuilding = true;
preCheck = ''
patchShebangs .
export LOGNAME=${LOGNAME:-foo}
@ -182,7 +155,7 @@ rec {
wrapProgram $i \
--prefix PERL5LIB ':' $out/libexec/hydra/lib:$PERL5LIB \
--prefix PATH ':' $out/bin:$hydraPath \
--set HYDRA_RELEASE ${tarball.version} \
--set HYDRA_RELEASE ${version} \
--set HYDRA_HOME $out/libexec/hydra \
--set NIX_RELEASE ${nix.name or "unknown"}
done

1
shell.nix Normal file
View file

@ -0,0 +1 @@
(import ./release.nix {}).build.x86_64-linux