Skip to content

Commit

Permalink
nix: Provide derivations for Daedalus installer
Browse files Browse the repository at this point in the history
  • Loading branch information
rvl committed Oct 18, 2019
1 parent 1493955 commit d81685e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 15 deletions.
44 changes: 29 additions & 15 deletions nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
# Test dependencies of cardano-wallet
, cardano-sl-node
, cardano-http-bridge
, jormungandr

# Dependencies of cardano-wallet-jormungandr
, jpkgs ? import ./jormungandr.nix { inherit pkgs; }
, jormungandr-win64 ? jpkgs.jormungandr-win64
, jormungandr ? jpkgs.jormungandr

# Customisations for cross-compiling
, iohk-extras ? {}
Expand All @@ -24,12 +28,11 @@ let
# Grab the compiler name from stack-to-nix output.
compiler = (stack-pkgs.extras {}).compiler.nix-name;

# Use a postInstall wrapping script if this is not a windows
# build. Otherwise, copy DLL dependencies.
wrapForPosix = postInstall: if pkgs.stdenv.hostPlatform.isWindows
then ''
cp -v ${pkgs.libffi}/bin/libffi-6.dll $out/bin
'' else postInstall;
# Make a postInstall wrapping script to provide dependencies.
# For the windows build, also copy DLL dependencies.
provideDeps = { nix, darwin ? "", windows ? "" }:
with pkgs.stdenv.hostPlatform;
if isWindows then windows else (if isDarwin then darwin else nix);

# Chop out a subdirectory of the source, so that the package is only
# rebuilt when something in the subdirectory changes.
Expand Down Expand Up @@ -76,18 +79,29 @@ let

packages.cardano-wallet-jormungandr.components.exes.cardano-wallet-jormungandr = {
build-tools = [ pkgs.makeWrapper];
postInstall = wrapForPosix ''
wrapProgram $out/bin/cardano-wallet-jormungandr \
--prefix PATH : ${jormungandr}/bin
'';
postInstall = provideDeps {
nix = ''
wrapProgram $out/bin/cardano-wallet-jormungandr \
--prefix PATH : ${jormungandr}/bin
'';
darwin = ''
cp ${jormungandr}/* $out/bin
'';
windows = ''
cp -v ${pkgs.libffi}/bin/libffi-6.dll $out/bin
cp ${jormungandr-win64}/* $out/bin
'';
};
};

packages.cardano-wallet-http-bridge.components.exes.cardano-wallet-http-bridge = {
build-tools = [ pkgs.makeWrapper];
postInstall = wrapForPosix ''
wrapProgram $out/bin/cardano-wallet-http-bridge \
--prefix PATH : ${cardano-http-bridge}/bin
'';
postInstall = provideDeps {
nix = ''
wrapProgram $out/bin/cardano-wallet-http-bridge \
--prefix PATH : ${cardano-http-bridge}/bin
'';
};
};

packages.cardano-wallet-http-bridge.components.benchmarks.restore = {
Expand Down
7 changes: 7 additions & 0 deletions release.nix
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ let
inherit pkgs project;
cardano-wallet-jormungandr = jobs.x86_64-pc-mingw32.cardano-wallet-jormungandr.x86_64-linux;
};

# These derivations are used for the Daedalus installer.
daedalus-jormungandr = with jobs; {
linux = native.cardano-wallet-jormungandr.x86_64-linux;
macos = native.cardano-wallet-jormungandr.x86_64-darwin;
windows = x86_64-pc-mingw32.cardano-wallet-jormungandr.x86_64-linux;
};
}
# Build the shell derivation in Hydra so that all its dependencies
# are cached.
Expand Down

0 comments on commit d81685e

Please sign in to comment.