Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for MacOS build on Nix #74

Merged
merged 4 commits into from
Sep 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
31 changes: 31 additions & 0 deletions .github/workflows/macos.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: MacOS Build
on:
pull_request: {}
push:
tags:
- v[0-9]+.*
branches:
- "release/*"
- main

jobs:
test-contracts:
name: Build MacOS Nix dependencies
runs-on: macos-14
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@V27
with:
extra_nix_config: |
experimental-features = nix-command flakes
- uses: cachix/cachix-action@v15
with:
name: ibc-starknet
extraPullNames: hermes-sdk,cosmos-nix
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}

- name: Run Nix build
run: |
sudo rm -rf /opt/homebrew
nix develop -c true
6 changes: 3 additions & 3 deletions flake.lock

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

8 changes: 6 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@

tools = {
inherit (nixpkgs)
pkg-config
protobuf
cargo-nextest
taplo
Expand All @@ -118,7 +117,12 @@
nixfmt = nixpkgs.nixfmt-rfc-style;
};

shell-deps = (builtins.attrValues starknet-pkgs) ++ (builtins.attrValues tools);
mac-deps = nixpkgs.lib.optional nixpkgs.stdenv.isDarwin [
nixpkgs.libiconv
nixpkgs.darwin.apple_sdk.frameworks.SystemConfiguration
];

shell-deps = (builtins.attrValues starknet-pkgs) ++ (builtins.attrValues tools) ++ mac-deps;
in
{
packages = {
Expand Down
8 changes: 7 additions & 1 deletion nix/cairo.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ let
OPENSSL_NO_VENDOR = 1;
PKG_CONFIG_PATH = "${nixpkgs.openssl.dev}/lib/pkgconfig";

nativeBuildInputs = [ nixpkgs.pkg-config ];
nativeBuildInputs = [
nixpkgs.pkg-config
];

buildInputs = nixpkgs.lib.optionals nixpkgs.stdenv.isDarwin [
nixpkgs.darwin.apple_sdk.frameworks.SystemConfiguration
];
};
in
cairo
4 changes: 4 additions & 0 deletions nix/scarb.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ let
cargoHash = "sha256-cAEwCX1zGJu4+ufdVSqBbksa1FLZWVNt2TLZ5JlGISk=";

SCARB_CORELIB_LOCAL_PATH = cairo-src + "/corelib";

buildInputs = nixpkgs.lib.optionals nixpkgs.stdenv.isDarwin [
nixpkgs.darwin.apple_sdk.frameworks.SystemConfiguration
];
};
in
cairo
6 changes: 5 additions & 1 deletion nix/snforge.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@ let
};
};

doCheck = false;

OPENSSL_NO_VENDOR = 1;
PKG_CONFIG_PATH = "${nixpkgs.openssl.dev}/lib/pkgconfig";

nativeBuildInputs = [ nixpkgs.pkg-config ];

doCheck = false;
buildInputs = nixpkgs.lib.optionals nixpkgs.stdenv.isDarwin [
nixpkgs.darwin.apple_sdk.frameworks.SystemConfiguration
];
};
in
snforge
6 changes: 5 additions & 1 deletion nix/starknet-devnet.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,16 @@ let
lockFile = starknet-devnet-src + "/Cargo.lock";
};

doCheck = false;

OPENSSL_NO_VENDOR = 1;
PKG_CONFIG_PATH = "${nixpkgs.openssl.dev}/lib/pkgconfig";

nativeBuildInputs = [ nixpkgs.pkg-config ];

doCheck = false;
buildInputs = nixpkgs.lib.optionals nixpkgs.stdenv.isDarwin [
nixpkgs.darwin.apple_sdk.frameworks.SystemConfiguration
];
};
in
starknet-devnet