Skip to content

Commit

Permalink
add an example daedalus-bridge
Browse files Browse the repository at this point in the history
  • Loading branch information
cleverca22 committed Oct 10, 2019
1 parent 6c724be commit 1922fc7
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 8 deletions.
31 changes: 31 additions & 0 deletions daedalus-bridge.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{ target, pkgs, haskellPackages, system, crossSystem, jormungandr }:

let
commonLib = import ./nix/iohk-common.nix {};
pkgsCross = commonLib.getPkgs { crossSystem = pkgs.lib.systems.examples.mingwW64; };
cardano-shell-src = pkgs.fetchFromGitHub {
owner = "input-output-hk";
repo = "cardano-shell";
rev = "efba204c14a83b9e1af9bb138c2d551fe3d7a43e";
sha256 = "0cr260b1drj4yal91fxcai9007jgbi2i2mh3mjnkq2rzjz6rvh8s";
};
cardano-shell = import cardano-shell-src { inherit system crossSystem; }; # todo, shell should accept target
in pkgs.runCommandCC "daedalus-bridge" {} ''
mkdir -pv $out
cd $out
cp ${haskellPackages.cardano-wallet-jormungandr.components.exes.cardano-wallet-jormungandr}/bin/cardano-wallet-jormungandr* .
cp ${cardano-shell.nix-tools.cexes.cardano-launcher.cardano-launcher}/bin/cardano-launcher* .
#cp {nix-tools.cexes.cardano-node.cardano-node}/bin/cardano-node* .
${pkgs.lib.optionalString (target == "x86_64-windows") ''
echo ${jormungandr}
cp ${pkgsCross.libffi}/bin/libffi-6.dll .
cp ${pkgsCross.openssl.out}/lib/libeay32.dll .
''}
${pkgs.lib.optionalString (target == "x86_64-linux") ''
chmod +w -R .
for bin in cardano-launcher; do
strip $bin
patchelf --shrink-rpath $bin
done
''}
''
29 changes: 21 additions & 8 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
{ system ? builtins.currentSystem
, crossSystem ? null
, config ? {}
# Import IOHK common nix lib
, iohkLib ? import ./nix/iohk-common.nix { inherit system crossSystem config; }
# Use nixpkgs pin from iohkLib
, pkgs ? iohkLib.pkgs
{ config ? {}
, target ? builtins.currentSystem
}:

with import ./nix/util.nix { inherit pkgs; };

let
commonLib = import ./nix/iohk-common.nix {};
lib = commonLib.pkgs.lib;
systemTable = {
x86_64-windows = builtins.currentSystem;
};
crossSystemTable = {
x86_64-windows = lib.systems.examples.mingwW64;
};
system = systemTable.${target} or target;
crossSystem = crossSystemTable.${target} or null;
# Import IOHK common nix lib
iohkLib = import ./nix/iohk-common.nix { inherit system crossSystem config; };
# Use nixpkgs pin from iohkLib
pkgs = iohkLib.pkgs;
in
with import ./nix/util.nix { inherit pkgs; };
let
haskell = iohkLib.nix-tools.haskell { inherit pkgs; };
src = iohkLib.cleanSourceHaskell ./.;
Expand Down Expand Up @@ -39,6 +50,8 @@ in {
tests = collectComponents "tests" isCardanoWallet haskellPackages;
benchmarks = collectComponents "benchmarks" isCardanoWallet haskellPackages;

daedalus-bridge = import ./daedalus-bridge.nix { inherit target pkgs haskellPackages system crossSystem jormungandr; };

shell = haskellPackages.shellFor {
name = "cardano-wallet-shell";
packages = ps: with ps; [
Expand Down

0 comments on commit 1922fc7

Please sign in to comment.