diff --git a/flake.nix b/flake.nix index eab982de5d..514292f758 100644 --- a/flake.nix +++ b/flake.nix @@ -47,6 +47,24 @@ > $out/nix-support/hydra-build-products ''; }); in + let iosPostInstall = bundleName: '' + ${pkgs.tree}/bin/tree $out + mkdir -p $out/_pkg + # copy over includes, we might want those, but maybe not. + # cp -r $out/lib/*/*/include $out/_pkg/ + # find the libHS...ghc-X.Y.Z.a static library; this is the + # rolled up one with all dependencies included. + find ./dist -name "libHS*.a" -exec cp {} $out/_pkg \; + find ${pkgs.libffi.overrideAttrs (old: { dontDisableStatic = true; })}/lib -name "*.a" -exec cp {} $out/_pkg \; + find ${pkgs.gmp6.override { withStatic = true; }}/lib -name "*.a" -exec cp {} $out/_pkg \; + # There is no static libc + ${pkgs.tree}/bin/tree $out/_pkg + (cd $out/_pkg; ${pkgs.zip}/bin/zip -r -9 $out/${bundleName}.zip *) + rm -fR $out/_pkg + mkdir -p $out/nix-support + echo "file binary-dist \"$(echo $out/*.zip)\"" \ + > $out/nix-support/hydra-build-products + ''; in rec { packages = { "lib:simplex-chat" = (drv pkgs).simplex-chat.components.library; @@ -225,24 +243,7 @@ # for iOS we also use -staticlib, to get one rolled up library. # still needs mac2ios patching of the archives. ghcOptions = [ "-staticlib" "-threaded" "-DIOS" ]; - postInstall = '' - ${pkgs.tree}/bin/tree $out - mkdir -p $out/_pkg - # copy over includes, we might want those, but maybe not. - # cp -r $out/lib/*/*/include $out/_pkg/ - # find the libHS...ghc-X.Y.Z.a static library; this is the - # rolled up one with all dependencies included. - find ./dist -name "libHS*.a" -exec cp {} $out/_pkg \; - find ${pkgs.libffi.overrideAttrs (old: { dontDisableStatic = true; })}/lib -name "*.a" -exec cp {} $out/_pkg \; - find ${pkgs.gmp6.override { withStatic = true; }}/lib -name "*.a" -exec cp {} $out/_pkg \; - # There is no static libc - ${pkgs.tree}/bin/tree $out/_pkg - (cd $out/_pkg; ${pkgs.zip}/bin/zip -r -9 $out/pkg-ios-aarch64-swift-json.zip *) - rm -fR $out/_pkg - mkdir -p $out/nix-support - echo "file binary-dist \"$(echo $out/*.zip)\"" \ - > $out/nix-support/hydra-build-products - ''; + postInstall = iosPostInstall "pkg-ios-aarch64-swift-json"; }; # This is the aarch64-darwin build with tagged JSON format (for Mac & Flutter) "aarch64-darwin:lib:simplex-chat" = (drv pkgs).simplex-chat.components.library.override { @@ -251,24 +252,7 @@ # for iOS we also use -staticlib, to get one rolled up library. # still needs mac2ios patching of the archives. ghcOptions = [ "-staticlib" "-threaded" "-DIOS" ]; - postInstall = '' - ${pkgs.tree}/bin/tree $out - mkdir -p $out/_pkg - # copy over includes, we might want those, but maybe not. - # cp -r $out/lib/*/*/include $out/_pkg/ - # find the libHS...ghc-X.Y.Z.a static library; this is the - # rolled up one with all dependencies included. - find ./dist -name "libHS*.a" -exec cp {} $out/_pkg \; - find ${pkgs.libffi.overrideAttrs (old: { dontDisableStatic = true; })}/lib -name "*.a" -exec cp {} $out/_pkg \; - find ${pkgs.gmp6.override { withStatic = true; }}/lib -name "*.a" -exec cp {} $out/_pkg \; - # There is no static libc - ${pkgs.tree}/bin/tree $out/_pkg - (cd $out/_pkg; ${pkgs.zip}/bin/zip -r -9 $out/pkg-ios-aarch64-tagged-json.zip *) - rm -fR $out/_pkg - mkdir -p $out/nix-support - echo "file binary-dist \"$(echo $out/*.zip)\"" \ - > $out/nix-support/hydra-build-products - ''; + postInstall = iosPostInstall "pkg-ios-aarch64-tagged-json"; }; }; "x86_64-darwin" = { @@ -279,24 +263,7 @@ # for iOS we also use -staticlib, to get one rolled up library. # still needs mac2ios patching of the archives. ghcOptions = [ "-staticlib" "-threaded" "-DIOS" ]; - postInstall = '' - ${pkgs.tree}/bin/tree $out - mkdir -p $out/_pkg - # copy over includes, we might want those, but maybe not. - # cp -r $out/lib/*/*/include $out/_pkg/ - # find the libHS...ghc-X.Y.Z.a static library; this is the - # rolled up one with all dependencies included. - find ./dist -name "libHS*.a" -exec cp {} $out/_pkg \; - find ${pkgs.libffi.overrideAttrs (old: { dontDisableStatic = true; })}/lib -name "*.a" -exec cp {} $out/_pkg \; - find ${pkgs.gmp6.override { withStatic = true; }}/lib -name "*.a" -exec cp {} $out/_pkg \; - # There is no static libc - ${pkgs.tree}/bin/tree $out/_pkg - (cd $out/_pkg; ${pkgs.zip}/bin/zip -r -9 $out/pkg-ios-x86_64-swift-json.zip *) - rm -fR $out/_pkg - mkdir -p $out/nix-support - echo "file binary-dist \"$(echo $out/*.zip)\"" \ - > $out/nix-support/hydra-build-products - ''; + postInstall = iosPostInstall "pkg-ios-x86_64-swift-json"; }; # This is the aarch64-darwin build with tagged JSON format (for Mac & Flutter) "x86_64-darwin:lib:simplex-chat" = (drv pkgs).simplex-chat.components.library.override { @@ -305,24 +272,7 @@ # for iOS we also use -staticlib, to get one rolled up library. # still needs mac2ios patching of the archives. ghcOptions = [ "-staticlib" "-threaded" "-DIOS" ]; - postInstall = '' - ${pkgs.tree}/bin/tree $out - mkdir -p $out/_pkg - # copy over includes, we might want those, but maybe not. - # cp -r $out/lib/*/*/include $out/_pkg/ - # find the libHS...ghc-X.Y.Z.a static library; this is the - # rolled up one with all dependencies included. - find ./dist -name "libHS*.a" -exec cp {} $out/_pkg \; - find ${pkgs.libffi.overrideAttrs (old: { dontDisableStatic = true; })}/lib -name "*.a" -exec cp {} $out/_pkg \; - find ${pkgs.gmp6.override { withStatic = true; }}/lib -name "*.a" -exec cp {} $out/_pkg \; - # There is no static libc - ${pkgs.tree}/bin/tree $out/_pkg - (cd $out/_pkg; ${pkgs.zip}/bin/zip -r -9 $out/pkg-ios-x86_64-tagged-json.zip *) - rm -fR $out/_pkg - mkdir -p $out/nix-support - echo "file binary-dist \"$(echo $out/*.zip)\"" \ - > $out/nix-support/hydra-build-products - ''; + postInstall = iosPostInstall "pkg-ios-x86_64-tagged-json"; }; }; }.${system} or {});