From 4be50fc9237670894b55708a1f8625fb3525582a Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> Date: Sun, 11 Sep 2022 09:38:40 +0100 Subject: [PATCH] nix: refactor ios parameters --- flake.nix | 69 ++++++++++++++++++++++++++----------------------------- 1 file changed, 33 insertions(+), 36 deletions(-) diff --git a/flake.nix b/flake.nix index 514292f758..a5e5329c72 100644 --- a/flake.nix +++ b/flake.nix @@ -65,6 +65,15 @@ echo "file binary-dist \"$(echo $out/*.zip)\"" \ > $out/nix-support/hydra-build-products ''; in + let iosOverrides = bundleName: { + smallAddressSpace = true; + enableShared = false; + # we need threaded here, otherwise all the queing logic doesn't work properly. + # for iOS we also use -staticlib, to get one rolled up library. + # still needs mac2ios patching of the archives. + ghcOptions = [ "-staticlib" "-threaded" "-DIOS" ]; + postInstall = iosPostInstall bundleName; + }; in rec { packages = { "lib:simplex-chat" = (drv pkgs).simplex-chat.components.library; @@ -235,45 +244,33 @@ ''; }; }; + + # builds for iOS and iOS simulator "aarch64-darwin" = { - # this is the aarch64-darwin iOS build (to be patched with mac2ios) - "aarch64-darwin-ios:lib:simplex-chat" = (drv' { pkgs' = pkgs; extra-modules = [{ packages.simplexmq.flags.swift = true; }]; } ).simplex-chat.components.library.override { - smallAddressSpace = true; enableShared = false; - # we need threaded here, otherwise all the queing logic doesn't work properly. - # for iOS we also use -staticlib, to get one rolled up library. - # still needs mac2ios patching of the archives. - ghcOptions = [ "-staticlib" "-threaded" "-DIOS" ]; - 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 { - smallAddressSpace = true; enableShared = false; - # we need threaded here, otherwise all the queing logic doesn't work properly. - # for iOS we also use -staticlib, to get one rolled up library. - # still needs mac2ios patching of the archives. - ghcOptions = [ "-staticlib" "-threaded" "-DIOS" ]; - postInstall = iosPostInstall "pkg-ios-aarch64-tagged-json"; - }; + # aarch64-darwin iOS build (to be patched with mac2ios) + "aarch64-darwin-ios:lib:simplex-chat" = (drv' { + pkgs' = pkgs; + extra-modules = [{ packages.simplexmq.flags.swift = true; }]; + }).simplex-chat.components.library.override ( + iosOverrides "pkg-ios-aarch64-swift-json" + ); + # aarch64-darwin build with tagged JSON format (for Mac & Flutter) + "aarch64-darwin:lib:simplex-chat" = (drv pkgs).simplex-chat.components.library.override ( + iosOverrides "pkg-ios-aarch64-tagged-json" + ); }; "x86_64-darwin" = { - # this is the aarch64-darwin iOS build (to be patched with mac2ios) - "x86_64-darwin-ios:lib:simplex-chat" = (drv' { pkgs' = pkgs; extra-modules = [{ packages.simplexmq.flags.swift = true; }]; } ).simplex-chat.components.library.override { - smallAddressSpace = true; enableShared = false; - # we need threaded here, otherwise all the queing logic doesn't work properly. - # for iOS we also use -staticlib, to get one rolled up library. - # still needs mac2ios patching of the archives. - ghcOptions = [ "-staticlib" "-threaded" "-DIOS" ]; - 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 { - smallAddressSpace = true; enableShared = false; - # we need threaded here, otherwise all the queing logic doesn't work properly. - # for iOS we also use -staticlib, to get one rolled up library. - # still needs mac2ios patching of the archives. - ghcOptions = [ "-staticlib" "-threaded" "-DIOS" ]; - postInstall = iosPostInstall "pkg-ios-x86_64-tagged-json"; - }; + # this is the x86_64-darwin iOS simulator build (to be patched with mac2ios) + "x86_64-darwin-ios:lib:simplex-chat" = (drv' { + pkgs' = pkgs; + extra-modules = [{ packages.simplexmq.flags.swift = true; }]; + }).simplex-chat.components.library.override ( + iosOverrides "pkg-ios-x86_64-swift-json" + ); + # This is the x86_64-darwin build with tagged JSON format (for Mac & Flutter iOS simulator) + "x86_64-darwin:lib:simplex-chat" = (drv pkgs).simplex-chat.components.library.override ( + iosOverrides "pkg-ios-x86_64-tagged-json" + ); }; }.${system} or {}); # build all packages in hydra.