2008-11-24 16:10:06 +01:00
|
|
|
{pkgs}:
|
|
|
|
|
|
|
|
with pkgs;
|
|
|
|
|
|
|
|
rec {
|
|
|
|
|
2009-03-26 15:11:59 +01:00
|
|
|
sourceTarball = args: import ./source-tarball.nix (
|
2008-12-10 11:58:07 +01:00
|
|
|
{ inherit stdenv autoconf automake libtool;
|
2008-11-28 17:12:50 +01:00
|
|
|
} // args);
|
2008-11-24 16:10:06 +01:00
|
|
|
|
2009-03-26 15:11:59 +01:00
|
|
|
makeSourceTarball = sourceTarball; # compatibility
|
|
|
|
|
|
|
|
binaryTarball = args: import ./binary-tarball.nix (
|
|
|
|
{ inherit stdenv;
|
|
|
|
} // args);
|
|
|
|
|
2010-03-05 11:09:22 +01:00
|
|
|
antBuild = args: import ./ant-build.nix (
|
2010-10-20 10:23:52 +02:00
|
|
|
{ inherit pkgs;
|
2010-03-05 11:09:22 +01:00
|
|
|
} // args);
|
|
|
|
|
2010-03-11 15:44:17 +01:00
|
|
|
mvnBuild = args: import ./maven-build.nix (
|
|
|
|
{ inherit stdenv;
|
|
|
|
} // args);
|
|
|
|
|
2008-11-24 16:10:06 +01:00
|
|
|
nixBuild = args: import ./nix-build.nix (
|
|
|
|
{ inherit stdenv;
|
|
|
|
} // args);
|
|
|
|
|
|
|
|
coverageAnalysis = args: nixBuild (
|
2014-03-03 13:39:30 +01:00
|
|
|
{ inherit lcov enableGCOVInstrumentation makeGCOVReport;
|
2008-11-24 16:10:06 +01:00
|
|
|
doCoverageAnalysis = true;
|
|
|
|
} // args);
|
|
|
|
|
releaseTools: add {clang,coverity}Analysis tools
These two expressions greatly simplify using the clang-analyzer or
Coverity static analyzer on your C/C++ projects. In fact, they are
identical to nixBuild in every way out of the box, and should 'Just
Work' providing your code can be compiled with Clang already.
The trick is that when running 'make', we actually just alias it to the
appropriate scan build tool, and add a post-build hook that will bundle
up the results appropriately and unalias it.
For Clang, we put the results in $out/analysis and add an 'analysis'
report to $out/nix-support/hydra-build-products pointing to the result
HTML - this means that if the analyzer finds any bugs, the HTML results
will automatically show up Hydra for easy viewing.
For Coverity, it's slightly different. Instead we run the build tool and
after we're done, we tar up the results in a format that Coverity Scan's
service understands. We put the tarball in $out/tarballs under the name
'foo-cov-int.xz' and add an entry for the file to hydra-build-products
as well for easy viewing.
Of course for Coverity you must then upload the build. A Hydra plugin to
do this is on the way, and it will automatically pick up the
cov-int.tar.xz for uploading.
Note that coverityAnalysis requires allowUnfree = true;, as well as the
cov-build tools, which you can download from https://scan.coverity.com -
they're not linked to your account or anything, it's just an annoying
registration wall.
Note this is a first draft. In particular, scan-build fixes the C/C++
compiler to be Clang, and it's perfectly reasonable to want to use Clang
for the analyzer but have scan-build invoke GCC instead.
Signed-off-by: Austin Seipp <aseipp@pobox.com>
2014-05-02 20:26:41 +02:00
|
|
|
clangAnalysis = args: nixBuild (
|
2015-02-20 21:45:03 +01:00
|
|
|
{ inherit clang-analyzer;
|
releaseTools: add {clang,coverity}Analysis tools
These two expressions greatly simplify using the clang-analyzer or
Coverity static analyzer on your C/C++ projects. In fact, they are
identical to nixBuild in every way out of the box, and should 'Just
Work' providing your code can be compiled with Clang already.
The trick is that when running 'make', we actually just alias it to the
appropriate scan build tool, and add a post-build hook that will bundle
up the results appropriately and unalias it.
For Clang, we put the results in $out/analysis and add an 'analysis'
report to $out/nix-support/hydra-build-products pointing to the result
HTML - this means that if the analyzer finds any bugs, the HTML results
will automatically show up Hydra for easy viewing.
For Coverity, it's slightly different. Instead we run the build tool and
after we're done, we tar up the results in a format that Coverity Scan's
service understands. We put the tarball in $out/tarballs under the name
'foo-cov-int.xz' and add an entry for the file to hydra-build-products
as well for easy viewing.
Of course for Coverity you must then upload the build. A Hydra plugin to
do this is on the way, and it will automatically pick up the
cov-int.tar.xz for uploading.
Note that coverityAnalysis requires allowUnfree = true;, as well as the
cov-build tools, which you can download from https://scan.coverity.com -
they're not linked to your account or anything, it's just an annoying
registration wall.
Note this is a first draft. In particular, scan-build fixes the C/C++
compiler to be Clang, and it's perfectly reasonable to want to use Clang
for the analyzer but have scan-build invoke GCC instead.
Signed-off-by: Austin Seipp <aseipp@pobox.com>
2014-05-02 20:26:41 +02:00
|
|
|
doClangAnalysis = true;
|
|
|
|
} // args);
|
|
|
|
|
|
|
|
coverityAnalysis = args: nixBuild (
|
|
|
|
{ inherit cov-build xz;
|
|
|
|
doCoverityAnalysis = true;
|
|
|
|
} // args);
|
|
|
|
|
2014-03-03 13:39:30 +01:00
|
|
|
gcovReport = args: import ./gcov-report.nix (
|
|
|
|
{ inherit runCommand lcov rsync;
|
|
|
|
} // args);
|
|
|
|
|
2009-03-02 14:45:48 +01:00
|
|
|
rpmBuild = args: import ./rpm-build.nix (
|
|
|
|
{ inherit vmTools;
|
|
|
|
} // args);
|
2008-11-25 01:20:51 +01:00
|
|
|
|
2009-03-02 14:45:48 +01:00
|
|
|
debBuild = args: import ./debian-build.nix (
|
|
|
|
{ inherit stdenv vmTools checkinstall;
|
2008-11-25 01:20:51 +01:00
|
|
|
} // args);
|
|
|
|
|
2013-03-20 15:52:08 +01:00
|
|
|
aggregate =
|
2013-08-15 02:29:08 +02:00
|
|
|
{ name, constituents, meta ? { } }:
|
2013-03-20 15:52:08 +01:00
|
|
|
pkgs.runCommand name
|
2013-08-15 02:29:08 +02:00
|
|
|
{ inherit constituents meta;
|
2013-08-21 14:50:34 +02:00
|
|
|
preferLocalBuild = true;
|
2013-03-20 15:52:08 +01:00
|
|
|
_hydraAggregate = true;
|
|
|
|
}
|
|
|
|
''
|
2013-08-15 01:40:09 +02:00
|
|
|
mkdir -p $out/nix-support
|
2013-08-21 11:47:30 +02:00
|
|
|
touch $out/nix-support/hydra-build-products
|
2013-08-15 02:29:08 +02:00
|
|
|
echo $constituents > $out/nix-support/hydra-aggregate-constituents
|
2013-08-15 01:40:09 +02:00
|
|
|
|
|
|
|
# Propagate build failures.
|
2013-08-15 02:29:08 +02:00
|
|
|
for i in $constituents; do
|
2013-08-15 01:40:09 +02:00
|
|
|
if [ -e $i/nix-support/failed ]; then
|
|
|
|
touch $out/nix-support/failed
|
|
|
|
fi
|
|
|
|
done
|
2013-03-20 15:52:08 +01:00
|
|
|
'';
|
|
|
|
|
2016-08-10 08:43:35 +02:00
|
|
|
/* Create a channel job which success depends on the success of all of
|
|
|
|
its contituents. Channel jobs are a special type of jobs that are
|
|
|
|
listed in the channel tab of Hydra and that can be suscribed.
|
|
|
|
A tarball of the src attribute is distributed via the channel.
|
|
|
|
|
|
|
|
- constituents: a list of derivations on which the channel success depends.
|
|
|
|
- name: the channel name that will be used in the hydra interface.
|
|
|
|
- src: should point to the root folder of the nix-expressions used by the
|
|
|
|
channel, typically a folder containing a `default.nix`.
|
|
|
|
|
|
|
|
channel {
|
|
|
|
constituents = [ foo bar baz ];
|
|
|
|
name = "my-channel";
|
|
|
|
src = ./.;
|
|
|
|
};
|
|
|
|
|
|
|
|
*/
|
|
|
|
channel =
|
|
|
|
{ name, src, constituents ? [], meta ? {}, isNixOS ? true, ... }@args:
|
|
|
|
stdenv.mkDerivation ({
|
|
|
|
preferLocalBuild = true;
|
|
|
|
_hydraAggregate = true;
|
|
|
|
|
|
|
|
phases = [ "unpackPhase" "patchPhase" "installPhase" ];
|
|
|
|
|
|
|
|
patchPhase = stdenv.lib.optionalString isNixOS ''
|
|
|
|
touch .update-on-nixos-rebuild
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/{tarballs,nix-support}
|
|
|
|
|
|
|
|
tar cJf "$out/tarballs/nixexprs.tar.xz" \
|
|
|
|
--owner=0 --group=0 --mtime="1970-01-01 00:00:00 UTC" \
|
|
|
|
--transform='s!^\.!${name}!' .
|
|
|
|
|
|
|
|
echo "channel - $out/tarballs/nixexprs.tar.xz" > "$out/nix-support/hydra-build-products"
|
|
|
|
echo $constituents > "$out/nix-support/hydra-aggregate-constituents"
|
|
|
|
|
|
|
|
# Propagate build failures.
|
|
|
|
for i in $constituents; do
|
|
|
|
if [ -e "$i/nix-support/failed" ]; then
|
|
|
|
touch "$out/nix-support/failed"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = meta // {
|
|
|
|
isHydraChannel = true;
|
|
|
|
};
|
|
|
|
} // removeAttrs args [ "meta" ]);
|
|
|
|
|
2008-11-25 01:20:51 +01:00
|
|
|
}
|