Skip to content

Commit

Permalink
nix: Bundle tools in binary release tarballs
Browse files Browse the repository at this point in the history
  • Loading branch information
rvl committed Jul 6, 2020
1 parent fe2ec07 commit 3c3e184
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 23 deletions.
2 changes: 1 addition & 1 deletion nix/macos-release.nix
Expand Up @@ -22,7 +22,7 @@ in pkgs.runCommand name {
buildInputs = with pkgs.buildPackages; [ gnutar gzip binutils ];
} ''
mkdir ${name}
cp -R ${concatMapStringsSep " " (exe: "${exe}/bin/*") exes} ${name}
cp -fR ${concatMapStringsSep " " (exe: "${exe}/bin/*") exes} ${name}
chmod -R 755 ${name}
mkdir -p $out/nix-support
Expand Down
6 changes: 4 additions & 2 deletions nix/windows-release.nix
Expand Up @@ -7,17 +7,19 @@
############################################################################

{ pkgs
, exe
, exes ? []
}:

let
# Take the filename from the first exe passed in
exe = pkgs.lib.head exes;
name = "${exe.meta.name}-win64";

in pkgs.runCommand name { buildInputs = [ pkgs.buildPackages.zip ]; } ''
mkdir -p $out/nix-support release
cd release
cp ${exe}/bin/* .
cp -fR ${pkgs.lib.concatMapStringsSep " " (exe: "${exe}/bin/*") exes} .
chmod -R +w .
zip -r $out/${name}.zip .
Expand Down
59 changes: 39 additions & 20 deletions release.nix
Expand Up @@ -188,66 +188,85 @@ let
############################################################################
# Release distribution jobs - these all have a Hydra download link.

# Which exes should be put in the release archive.
releaseContents = rec {
jormungandr = [
"cardano-wallet-jormungandr"
"jormungandr"
"jormungandr-cli"
];
cardanoNodeCommon = [
"bech32"
"cardano-address"
"cardano-cli"
"cardano-node"
"cardano-tx"
];
byron = [ "cardano-wallet-byron" ] ++ cardanoNodeCommon;
shelley = [ "cardano-wallet-shelley" ] ++ cardanoNodeCommon;
};

# function to take a list of jobs by name from a jobset.
selectExes = subjobs: system: map (exe: subjobs.${exe}.${system});

releaseDistJobs = optionalAttrs buildWindows {
# Windows release ZIP archive - jormungandr
cardano-wallet-jormungandr-win64 = import ./nix/windows-release.nix {
inherit pkgs;
exe = jobs.x86_64-w64-mingw32.cardano-wallet-jormungandr.x86_64-linux;
exes = selectExes jobs.x86_64-w64-mingw32 "x86_64-linux" releaseContents.jormungandr;
};

# Windows release ZIP archive - byron rewrite
cardano-wallet-byron-win64 = import ./nix/windows-release.nix {
inherit pkgs;
exe = jobs.x86_64-w64-mingw32.cardano-wallet-byron.x86_64-linux;
exes = selectExes jobs.x86_64-w64-mingw32 "x86_64-linux" releaseContents.jormungandr;
};

# Windows release ZIP archive - shelley
cardano-wallet-shelley-win64 = import ./nix/windows-release.nix {
inherit pkgs;
exe = jobs.x86_64-w64-mingw32.cardano-wallet-shelley.x86_64-linux;
exes = selectExes jobs.x86_64-w64-mingw32 "x86_64-linux" releaseContents.jormungandr;
};

# This is used for testing the build on windows.
cardano-wallet-tests-win64 = import ./nix/windows-testing-bundle.nix {
cardano-wallet-tests-win64 = let
winJobs = jobs."${mingwW64.config}";
in import ./nix/windows-testing-bundle.nix {
inherit pkgs project;
cardano-wallet-jormungandr = jobs.x86_64-w64-mingw32.cardano-wallet-jormungandr.x86_64-linux;
cardano-wallet-byron = jobs.x86_64-w64-mingw32.cardano-wallet-byron.x86_64-linux;
cardano-wallet-shelley = jobs.x86_64-w64-mingw32.cardano-wallet-shelley.x86_64-linux;
cardano-node = jobs.x86_64-w64-mingw32.cardano-node.x86_64-linux;
tests = collectTests jobs.x86_64-w64-mingw32.tests;
benchmarks = collectTests jobs.x86_64-w64-mingw32.benchmarks;
cardano-wallet-jormungandr = winJobs.cardano-wallet-jormungandr.x86_64-linux;
cardano-wallet-byron = winJobs.cardano-wallet-byron.x86_64-linux;
cardano-wallet-shelley = winJobs.cardano-wallet-shelley.x86_64-linux;
cardano-node = winJobs.cardano-node.x86_64-linux;
tests = collectTests winJobs.tests;
benchmarks = collectTests winJobs.benchmarks;
};
} // optionalAttrs buildMusl {
# Fully-static linux binaries
cardano-wallet-jormungandr-linux64 = import ./nix/linux-release.nix {
inherit pkgs;
exes = [ jobs.musl64.cardano-wallet-jormungandr.x86_64-linux ];
exes = selectExes jobs.musl64 "x86_64-linux" releaseContents.jormungandr;
};
cardano-wallet-byron-linux64 = import ./nix/linux-release.nix {
inherit pkgs;
exes = [
jobs.musl64.cardano-wallet-byron.x86_64-linux
# SRE-83 dependencies fail to build
# jobs.musl64.cardano-node.x86_64-linux
];
exes = selectExes jobs.musl64 "x86_64-linux" releaseContents.byron;
};
cardano-wallet-shelley-linux64 = import ./nix/linux-release.nix {
inherit pkgs;
exes = [ jobs.musl64.cardano-wallet-shelley.x86_64-linux ];
exes = selectExes jobs.musl64 "x86_64-linux" releaseContents.shelley;
};
} // optionalAttrs buildMacOS {
# macOS binary and dependencies in tarball
cardano-wallet-jormungandr-macos64 = import ./nix/macos-release.nix {
inherit pkgs;
exes = [ jobs.native.cardano-wallet-jormungandr.x86_64-darwin ];
exes = selectExes jobs.native "x86_64-darwin" releaseContents.jormungandr;
};
cardano-wallet-byron-macos64 = import ./nix/macos-release.nix {
inherit pkgs;
exes = [ jobs.native.cardano-wallet-byron.x86_64-darwin ];
exes = selectExes jobs.native "x86_64-darwin" releaseContents.byron;
};
cardano-wallet-shelley-macos64 = import ./nix/macos-release.nix {
inherit pkgs;
exes = [ jobs.native.cardano-wallet-shelley.x86_64-darwin ];
exes = selectExes jobs.native "x86_64-darwin" releaseContents.shelley;
};
};

Expand Down

0 comments on commit 3c3e184

Please sign in to comment.