2024-05-02 00:46:19 +00:00
|
|
|
{ lib, pkgs }:
|
|
|
|
|
|
|
|
let
|
|
|
|
inherit (lib) optionalString;
|
|
|
|
|
|
|
|
inherit (pkgs)
|
|
|
|
autoconf
|
|
|
|
automake
|
|
|
|
checkinstall
|
|
|
|
clang-analyzer
|
|
|
|
cov-build
|
|
|
|
enableGCOVInstrumentation
|
|
|
|
lcov
|
|
|
|
libtool
|
|
|
|
makeGCOVReport
|
|
|
|
runCommand
|
|
|
|
stdenv
|
|
|
|
vmTools
|
|
|
|
xz
|
|
|
|
;
|
|
|
|
in
|
|
|
|
|
|
|
|
rec {
|
|
|
|
|
2024-06-30 08:16:52 +00:00
|
|
|
sourceTarball =
|
|
|
|
args:
|
|
|
|
import ./source-tarball.nix (
|
|
|
|
{
|
|
|
|
inherit
|
|
|
|
lib
|
|
|
|
stdenv
|
|
|
|
autoconf
|
|
|
|
automake
|
|
|
|
libtool
|
|
|
|
;
|
|
|
|
}
|
|
|
|
// args
|
|
|
|
);
|
2024-05-02 00:46:19 +00:00
|
|
|
|
|
|
|
makeSourceTarball = sourceTarball; # compatibility
|
|
|
|
|
2024-06-30 08:16:52 +00:00
|
|
|
binaryTarball = args: import ./binary-tarball.nix ({ inherit lib stdenv; } // args);
|
2024-05-02 00:46:19 +00:00
|
|
|
|
2024-06-30 08:16:52 +00:00
|
|
|
mvnBuild = args: import ./maven-build.nix ({ inherit lib stdenv; } // args);
|
2024-05-02 00:46:19 +00:00
|
|
|
|
2024-06-30 08:16:52 +00:00
|
|
|
nixBuild = args: import ./nix-build.nix ({ inherit lib stdenv; } // args);
|
2024-05-02 00:46:19 +00:00
|
|
|
|
2024-06-30 08:16:52 +00:00
|
|
|
coverageAnalysis =
|
|
|
|
args:
|
|
|
|
nixBuild (
|
|
|
|
{
|
|
|
|
inherit lcov enableGCOVInstrumentation makeGCOVReport;
|
|
|
|
doCoverageAnalysis = true;
|
|
|
|
}
|
|
|
|
// args
|
|
|
|
);
|
|
|
|
|
|
|
|
clangAnalysis =
|
|
|
|
args:
|
|
|
|
nixBuild (
|
|
|
|
{
|
|
|
|
inherit clang-analyzer;
|
|
|
|
doClangAnalysis = true;
|
|
|
|
}
|
|
|
|
// args
|
|
|
|
);
|
|
|
|
|
|
|
|
coverityAnalysis =
|
|
|
|
args:
|
|
|
|
nixBuild (
|
|
|
|
{
|
|
|
|
inherit cov-build xz;
|
|
|
|
doCoverityAnalysis = true;
|
|
|
|
}
|
|
|
|
// args
|
|
|
|
);
|
|
|
|
|
|
|
|
rpmBuild = args: import ./rpm-build.nix ({ inherit lib vmTools; } // args);
|
|
|
|
|
|
|
|
debBuild =
|
|
|
|
args:
|
|
|
|
import ./debian-build.nix (
|
|
|
|
{
|
|
|
|
inherit
|
|
|
|
lib
|
|
|
|
stdenv
|
|
|
|
vmTools
|
|
|
|
checkinstall
|
|
|
|
;
|
|
|
|
}
|
|
|
|
// args
|
|
|
|
);
|
2024-05-02 00:46:19 +00:00
|
|
|
|
|
|
|
aggregate =
|
2024-06-30 08:16:52 +00:00
|
|
|
{
|
|
|
|
name,
|
|
|
|
constituents,
|
|
|
|
meta ? { },
|
|
|
|
}:
|
2024-05-02 00:46:19 +00:00
|
|
|
pkgs.runCommand name
|
2024-06-30 08:16:52 +00:00
|
|
|
{
|
|
|
|
inherit constituents meta;
|
2024-05-02 00:46:19 +00:00
|
|
|
preferLocalBuild = true;
|
|
|
|
_hydraAggregate = true;
|
|
|
|
}
|
|
|
|
''
|
|
|
|
mkdir -p $out/nix-support
|
|
|
|
touch $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
|
|
|
|
'';
|
|
|
|
|
2024-06-30 08:16:52 +00: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 = ./.;
|
|
|
|
};
|
2024-05-02 00:46:19 +00:00
|
|
|
*/
|
|
|
|
channel =
|
2024-06-30 08:16:52 +00:00
|
|
|
{
|
|
|
|
name,
|
|
|
|
src,
|
|
|
|
constituents ? [ ],
|
|
|
|
meta ? { },
|
|
|
|
isNixOS ? true,
|
|
|
|
...
|
|
|
|
}@args:
|
|
|
|
stdenv.mkDerivation (
|
|
|
|
{
|
|
|
|
preferLocalBuild = true;
|
|
|
|
_hydraAggregate = true;
|
2024-05-02 00:46:19 +00:00
|
|
|
|
2024-06-30 08:16:52 +00:00
|
|
|
dontConfigure = true;
|
|
|
|
dontBuild = true;
|
2024-05-02 00:46:19 +00:00
|
|
|
|
2024-06-30 08:16:52 +00:00
|
|
|
patchPhase = optionalString isNixOS ''
|
|
|
|
touch .update-on-nixos-rebuild
|
|
|
|
'';
|
2024-05-02 00:46:19 +00:00
|
|
|
|
2024-06-30 08:16:52 +00:00
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/{tarballs,nix-support}
|
2024-05-02 00:46:19 +00:00
|
|
|
|
2024-06-30 08:16:52 +00:00
|
|
|
tar cJf "$out/tarballs/nixexprs.tar.xz" \
|
|
|
|
--owner=0 --group=0 --mtime="1970-01-01 00:00:00 UTC" \
|
|
|
|
--transform='s!^\.!${name}!' .
|
2024-05-02 00:46:19 +00:00
|
|
|
|
2024-06-30 08:16:52 +00:00
|
|
|
echo "channel - $out/tarballs/nixexprs.tar.xz" > "$out/nix-support/hydra-build-products"
|
|
|
|
echo $constituents > "$out/nix-support/hydra-aggregate-constituents"
|
2024-05-02 00:46:19 +00:00
|
|
|
|
2024-06-30 08:16:52 +00:00
|
|
|
# Propagate build failures.
|
|
|
|
for i in $constituents; do
|
|
|
|
if [ -e "$i/nix-support/failed" ]; then
|
|
|
|
touch "$out/nix-support/failed"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
'';
|
2024-05-02 00:46:19 +00:00
|
|
|
|
2024-06-30 08:16:52 +00:00
|
|
|
meta = meta // {
|
|
|
|
isHydraChannel = true;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
// removeAttrs args [ "meta" ]
|
|
|
|
);
|
2024-05-02 00:46:19 +00:00
|
|
|
|
|
|
|
}
|