2024-05-31 23:35:13 +00:00
|
|
|
{ hydraJobs, pkgs }:
|
|
|
|
let
|
|
|
|
inherit (pkgs) lib;
|
|
|
|
lix = hydraJobs.build.x86_64-linux;
|
|
|
|
|
2024-06-13 21:03:27 +00:00
|
|
|
# This is all so clumsy because we can't use arguments to functions in
|
|
|
|
# flakes, and certainly not with n-e-j.
|
|
|
|
profiles = {
|
|
|
|
# Used for testing
|
|
|
|
x86_64-linux-only = {
|
|
|
|
systems = [ "x86_64-linux" ];
|
|
|
|
dockerSystems = [ "x86_64-linux" ];
|
|
|
|
};
|
|
|
|
all = {
|
|
|
|
systems = [
|
|
|
|
"x86_64-linux"
|
|
|
|
"aarch64-linux"
|
|
|
|
"aarch64-darwin"
|
|
|
|
"x86_64-darwin"
|
|
|
|
];
|
|
|
|
dockerSystems = [
|
|
|
|
"x86_64-linux"
|
|
|
|
"aarch64-linux"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
2024-05-31 23:35:13 +00:00
|
|
|
|
|
|
|
doTarball =
|
|
|
|
{
|
|
|
|
target,
|
|
|
|
targetName,
|
|
|
|
rename ? null,
|
|
|
|
}:
|
|
|
|
''
|
|
|
|
echo "doing: ${target}"
|
|
|
|
# expand wildcard
|
|
|
|
filename=$(echo ${target}/${targetName})
|
|
|
|
basename="$(basename $filename)"
|
|
|
|
|
|
|
|
echo $filename $basename
|
|
|
|
cp -v "$filename" "$out"
|
|
|
|
${lib.optionalString (rename != null) ''
|
|
|
|
mv "$out/$basename" "$out/${rename}"
|
|
|
|
basename="${rename}"
|
|
|
|
''}
|
|
|
|
sha256sum --binary $filename | cut -f1 -d' ' > $out/$basename.sha256
|
|
|
|
'';
|
|
|
|
|
2024-06-13 21:03:27 +00:00
|
|
|
targetsFor =
|
|
|
|
{ systems, dockerSystems }:
|
2024-05-31 23:35:13 +00:00
|
|
|
builtins.map (system: {
|
|
|
|
target = hydraJobs.binaryTarball.${system};
|
|
|
|
targetName = "*.tar.xz";
|
|
|
|
}) systems
|
|
|
|
++ builtins.map (system: {
|
2024-06-07 08:35:26 +00:00
|
|
|
target = hydraJobs.dockerImage.${system}.tarball;
|
2024-05-31 23:35:13 +00:00
|
|
|
targetName = "image.tar.gz";
|
|
|
|
rename = "lix-${lix.version}-docker-image-${system}.tar.gz";
|
|
|
|
}) dockerSystems;
|
|
|
|
|
|
|
|
manualTar = pkgs.runCommand "lix-manual-tarball" { } ''
|
|
|
|
mkdir -p $out
|
|
|
|
cp -r ${lix.doc}/share/doc/nix/manual lix-${lix.version}-manual
|
|
|
|
tar -cvzf "$out/lix-${lix.version}-manual.tar.gz" lix-${lix.version}-manual
|
|
|
|
'';
|
|
|
|
|
2024-06-13 21:03:27 +00:00
|
|
|
tarballsFor =
|
|
|
|
{ systems, dockerSystems }:
|
|
|
|
pkgs.runCommand "lix-release-tarballs" { } ''
|
|
|
|
mkdir -p $out
|
|
|
|
${lib.concatMapStringsSep "\n" doTarball (targetsFor {
|
|
|
|
inherit systems dockerSystems;
|
|
|
|
})}
|
2024-06-14 00:14:06 +00:00
|
|
|
${doTarball {
|
|
|
|
target = manualTar;
|
|
|
|
targetName = "lix-*.tar.gz";
|
|
|
|
}}
|
2024-06-13 21:03:27 +00:00
|
|
|
cp -r ${lix.doc}/share/doc/nix/manual $out
|
|
|
|
'';
|
2024-05-31 23:35:13 +00:00
|
|
|
in
|
2024-06-13 21:03:27 +00:00
|
|
|
(builtins.mapAttrs (
|
|
|
|
_:
|
|
|
|
{ systems, dockerSystems }:
|
|
|
|
{
|
|
|
|
build = lib.filterAttrs (x: _: builtins.elem x systems) hydraJobs.build;
|
|
|
|
tarballs = tarballsFor { inherit systems dockerSystems; };
|
|
|
|
}
|
|
|
|
) profiles)
|
|
|
|
// {
|
2024-05-31 23:35:13 +00:00
|
|
|
inherit (hydraJobs) build;
|
2024-06-13 21:03:27 +00:00
|
|
|
inherit tarballsFor;
|
2024-05-31 23:35:13 +00:00
|
|
|
}
|