From 238e7b79ad4f14568dc1b76a0efda016c6536a52 Mon Sep 17 00:00:00 2001 From: ThetaSinner Date: Tue, 18 Jun 2024 18:46:48 +0100 Subject: [PATCH] Define more binaries on other platforms --- flake.nix | 66 ++++++++++++++++++++++++++----------------------------- 1 file changed, 31 insertions(+), 35 deletions(-) diff --git a/flake.nix b/flake.nix index 0808db4..e6f8aa6 100644 --- a/flake.nix +++ b/flake.nix @@ -33,41 +33,37 @@ outputs = inputs @ { nixpkgs, crane, flake-utils, rust-overlay, ... }: flake-utils.lib.eachDefaultSystem (localSystem: { - packages = { - holochain_aarch64-linux = import ./modules/holochain-cross.nix { - inherit localSystem inputs; - crate = "holochain"; - package = "holochain"; - crossSystem = "aarch64-linux"; - rustTargetTriple = "aarch64-unknown-linux-gnu"; - }; - holochain_x86_64-linux = import ./modules/holochain-cross.nix { - inherit localSystem inputs; - crate = "holochain"; - package = "holochain"; - crossSystem = "x86_64-linux"; - rustTargetTriple = "x86_64-unknown-linux-gnu"; - }; - holochain_x86_64-windows = import ./modules/holochain-windows.nix { - inherit localSystem inputs; - crate = "holochain"; - package = "holochain"; - }; - - holochain_cli_x86_64-windows = import ./modules/holochain-windows.nix { - inherit localSystem inputs; - crate = "hc"; - package = "holochain_cli"; - }; - } // (if localSystem == "aarch64-darwin" then { - holochain_aarch64-apple = import ./modules/holochain-cross.nix { - inherit localSystem inputs; - crate = "holochain"; - package = "holochain"; - crossSystem = "aarch64-darwin"; - rustTargetTriple = "aarch64-apple-darwin"; - }; - } else { }); + packages = + let + defineHolochainPackages = { crate, package }: { + "${package}_aarch64-linux" = import ./modules/holochain-cross.nix { + inherit localSystem inputs crate package; + crossSystem = "aarch64-linux"; + rustTargetTriple = "aarch64-unknown-linux-gnu"; + }; + "${package}_x86_64-linux" = import ./modules/holochain-cross.nix { + inherit localSystem inputs crate package; + crossSystem = "x86_64-linux"; + rustTargetTriple = "x86_64-unknown-linux-gnu"; + }; + "${package}_x86_64-windows" = import ./modules/holochain-windows.nix { + inherit localSystem inputs crate package; + }; + } // (if localSystem == "aarch64-darwin" then { + # Only define darwin builds if we're on a darwin host because Apple don't like people cross compiling + # from other systems. + "${package}_aarch64-apple" = import ./modules/holochain-cross.nix { + inherit localSystem inputs crate package; + crossSystem = "aarch64-darwin"; + rustTargetTriple = "aarch64-apple-darwin"; + }; + } else { }); + in + (defineHolochainPackages { crate = "holochain"; package = "holochain"; }) // + (defineHolochainPackages { crate = "hc"; package = "holochain_cli"; }) // + (defineHolochainPackages { crate = "hc_run_local_services"; package = "holochain_cli_run_local_services"; }) // + (defineHolochainPackages { crate = "holochain_terminal"; package = "hcterm"; }) + ; }) // { # Add dev helpers that are not required to be platform agnostic formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixpkgs-fmt;