Skip to content

Commit

Permalink
Merge pull request #1 from holochain/bundle
Browse files Browse the repository at this point in the history
Add bundles
  • Loading branch information
ThetaSinner authored Jun 24, 2024
2 parents 3505a15 + f1fe26f commit ffbb237
Show file tree
Hide file tree
Showing 3 changed files with 166 additions and 2 deletions.
40 changes: 39 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build-holochain:
Expand Down Expand Up @@ -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
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
100 changes: 100 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 27 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,24 @@
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, ... }:
flake-utils.lib.eachDefaultSystem
(localSystem: {
packages =
let
pkgs = nixpkgs.legacyPackages.${localSystem};

defineHolochainPackages = { crate, package }: {
"${package}_aarch64-linux" = import ./modules/holochain-cross.nix {
inherit localSystem inputs crate package;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ffbb237

Please sign in to comment.