diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 8e03f00..b909781 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -4,6 +4,9 @@ on: push: branches: - main + pull_request: + branches: + - main jobs: build-holochain: @@ -82,4 +85,39 @@ jobs: install_url: https://releases.nixos.org/nix/nix-2.20.4/install - name: Build for x86_64-apple-darwin - run: nix build .#lair_keystore_aarch64-apple \ No newline at end of file + run: nix build .#lair_keystore_aarch64-apple + + bundle-x86-64-linux: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install nix + uses: cachix/install-nix-action@v26 + with: + install_url: https://releases.nixos.org/nix/nix-2.20.4/install + + - name: Build Lair Keystore + run: | + nix bundle .#holonix_lair_keystore + ./lair-keystore --version + + - name: Build Holochain + run: | + nix bundle .#holonix_holochain + ./holochain --version + + - name: Build hc CLI + run: | + nix bundle .#holonix_hc + ./hc --version + + - name: Build hc-run-local-services CLI + run: | + nix bundle .#holonix_hc_run_local_services + ./hc-run-local-services --version + + - name: Build hcterm CLI + run: | + nix bundle .#holonix_hcterm + ./hcterm --version diff --git a/flake.lock b/flake.lock index e5f0654..e20da8a 100644 --- a/flake.lock +++ b/flake.lock @@ -41,6 +41,24 @@ "type": "github" } }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1717285511, + "narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": "systems" @@ -59,6 +77,40 @@ "type": "github" } }, + "hc-launch": { + "flake": false, + "locked": { + "lastModified": 1715106263, + "narHash": "sha256-a7iQ8pKGz6fghJrtXq0Xamp57GE8Hd3w5YQASzz5Wlk=", + "owner": "holochain", + "repo": "launcher", + "rev": "92bd39e1c66912d61c35c4725d7b106959888670", + "type": "github" + }, + "original": { + "owner": "holochain", + "ref": "holochain-weekly", + "repo": "launcher", + "type": "github" + } + }, + "hc-scaffold": { + "flake": false, + "locked": { + "lastModified": 1716496525, + "narHash": "sha256-DB4KmZ5rVXcEiet843ivQuT9iB1JHuzIUl45ZBjPJXg=", + "owner": "holochain", + "repo": "scaffolding", + "rev": "d99193b228a4ff972987ded190886d8dddc374bf", + "type": "github" + }, + "original": { + "owner": "holochain", + "ref": "holochain-weekly", + "repo": "scaffolding", + "type": "github" + } + }, "holochain": { "flake": false, "locked": { @@ -76,6 +128,41 @@ "type": "github" } }, + "holonix": { + "inputs": { + "crane": [ + "crane" + ], + "flake-parts": "flake-parts", + "hc-launch": "hc-launch", + "hc-scaffold": "hc-scaffold", + "holochain": [ + "holochain" + ], + "lair-keystore": [ + "lair-keystore" + ], + "nixpkgs": [ + "nixpkgs" + ], + "rust-overlay": [ + "rust-overlay" + ] + }, + "locked": { + "lastModified": 1718283711, + "narHash": "sha256-ul5LwVlhwd+KgdWxnI8JdarhEEn37wcrGLpSyMh8HAk=", + "owner": "holochain", + "repo": "holonix", + "rev": "2ce93ddea7dabc128d9888cfc788a985ecb8c96c", + "type": "github" + }, + "original": { + "owner": "holochain", + "repo": "holonix", + "type": "github" + } + }, "lair-keystore": { "flake": false, "locked": { @@ -108,12 +195,25 @@ "type": "github" } }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1717284937, + "narHash": "sha256-lIbdfCsf8LMFloheeE6N31+BMIeixqyQWbSr2vk79EQ=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz" + } + }, "root": { "inputs": { "crane": "crane", "fenix": "fenix", "flake-utils": "flake-utils", "holochain": "holochain", + "holonix": "holonix", "lair-keystore": "lair-keystore", "nixpkgs": "nixpkgs", "rust-overlay": "rust-overlay" diff --git a/flake.nix b/flake.nix index a7384ed..03cfbf5 100644 --- a/flake.nix +++ b/flake.nix @@ -33,6 +33,15 @@ url = "github:holochain/lair"; flake = false; }; + + holonix = { + url = "github:holochain/holonix"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.crane.follows = "crane"; + inputs.rust-overlay.follows = "rust-overlay"; + inputs.holochain.follows = "holochain"; + inputs.lair-keystore.follows = "lair-keystore"; + }; }; outputs = inputs @ { nixpkgs, crane, flake-utils, rust-overlay, ... }: @@ -40,6 +49,8 @@ (localSystem: { packages = let + pkgs = nixpkgs.legacyPackages.${localSystem}; + defineHolochainPackages = { crate, package }: { "${package}_aarch64-linux" = import ./modules/holochain-cross.nix { inherit localSystem inputs crate package; @@ -87,12 +98,27 @@ rustTargetTriple = "aarch64-apple-darwin"; }; } else { }); + + extractHolochainBin = bin: pkgs.stdenv.mkDerivation { + name = bin; + unpackPhase = "true"; + installPhase = '' + mkdir -p $out/bin + cp ${inputs.holonix.packages.${localSystem}.holochain}/bin/${bin} $out/bin + ''; + }; 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"; }) // - (defineLairKeystorePackages { }) + (defineLairKeystorePackages { }) // (if localSystem != "aarch64-linux" then { + holonix_holochain = extractHolochainBin "holochain"; + holonix_hc = extractHolochainBin "hc"; + holonix_hc_run_local_services = extractHolochainBin "hc-run-local-services"; + holonix_hcterm = extractHolochainBin "hcterm"; + holonix_lair_keystore = inputs.holonix.packages.${localSystem}.lair-keystore; + } else { }) ; }) // { # Add dev helpers that are not required to be platform agnostic