core/pkgs/build-support/release/default.nix

119 lines
3.4 KiB
Nix
Raw Normal View History

2024-05-02 00:46:19 +00:00
{ lib, pkgs }:
let
inherit (lib) optionalString;
inherit (pkgs)
2024-05-13 21:24:10 +00:00
autoconf automake checkinstall clang-analyzer cov-build
enableGCOVInstrumentation lcov libtool makeGCOVReport runCommand stdenv
vmTools xz;
in rec {
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-05-13 21:24:10 +00:00
binaryTarball = args:
import ./binary-tarball.nix ({ inherit lib stdenv; } // args);
2024-05-02 00:46:19 +00:00
2024-05-13 21:24:10 +00:00
mvnBuild = args: import ./maven-build.nix ({ inherit lib stdenv; } // args);
2024-05-02 00:46:19 +00:00
2024-05-13 21:24:10 +00:00
nixBuild = args: import ./nix-build.nix ({ inherit lib stdenv; } // args);
2024-05-02 00:46:19 +00:00
2024-05-13 21:24:10 +00:00
coverageAnalysis = args:
nixBuild ({
inherit lcov enableGCOVInstrumentation makeGCOVReport;
2024-05-02 00:46:19 +00:00
doCoverageAnalysis = true;
} // args);
2024-05-13 21:24:10 +00:00
clangAnalysis = args:
nixBuild ({
inherit clang-analyzer;
2024-05-02 00:46:19 +00:00
doClangAnalysis = true;
} // args);
2024-05-13 21:24:10 +00:00
coverityAnalysis = args:
nixBuild ({
inherit cov-build xz;
2024-05-02 00:46:19 +00:00
doCoverityAnalysis = true;
} // args);
2024-05-13 21:24:10 +00:00
rpmBuild = args: import ./rpm-build.nix ({ inherit lib vmTools; } // args);
2024-05-02 00:46:19 +00:00
2024-05-13 21:24:10 +00:00
debBuild = args:
import ./debian-build.nix
({ inherit lib stdenv vmTools checkinstall; } // args);
2024-05-02 00:46:19 +00:00
2024-05-13 21:24:10 +00:00
aggregate = { name, constituents, meta ? { } }:
pkgs.runCommand name {
inherit constituents meta;
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-05-02 00:46:19 +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 = ./.;
};
*/
channel =
2024-05-13 21:24:10 +00:00
{ name, src, constituents ? [ ], meta ? { }, isNixOS ? true, ... }@args:
2024-05-02 00:46:19 +00:00
stdenv.mkDerivation ({
preferLocalBuild = true;
_hydraAggregate = true;
dontConfigure = true;
dontBuild = true;
patchPhase = 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
'';
2024-05-13 21:24:10 +00:00
meta = meta // { isHydraChannel = true; };
2024-05-02 00:46:19 +00:00
} // removeAttrs args [ "meta" ]);
}